use of org.apache.geode.InternalGemFireError in project geode by apache.
the class RebalanceOperationImpl method getResults.
public RebalanceResults getResults(long timeout, TimeUnit unit) throws CancellationException, TimeoutException, InterruptedException {
long endTime = unit.toNanos(timeout) + System.nanoTime();
RebalanceResultsImpl results = new RebalanceResultsImpl();
List<Future<RebalanceResults>> frlist = getFutureList();
for (Future<RebalanceResults> fr : frlist) {
try {
long waitTime = endTime - System.nanoTime();
RebalanceResults rr = fr.get(waitTime, TimeUnit.NANOSECONDS);
results.addDetails((RebalanceResultsImpl) rr);
} catch (ExecutionException e) {
if (e.getCause() instanceof GemFireException) {
throw (GemFireException) e.getCause();
} else if (e.getCause() instanceof InternalGemFireError) {
throw (InternalGemFireError) e.getCause();
} else {
throw new InternalGemFireError(e.getCause());
}
}
}
return results;
}
use of org.apache.geode.InternalGemFireError in project geode by apache.
the class CommandInitializer method registerCommand.
/**
* Register a new command with the system.
*
* @param messageType - An ordinal for this message. This must be something defined in MessageType
* that has not already been allocated to a different command.
* @param versionToNewCommand The command to register, for different versions. The key is the
* earliest version for which this command class is valid (starting with GFE_57). The value
* is the command object for clients starting with that version.
*/
public static void registerCommand(int messageType, Map<Version, Command> versionToNewCommand) {
Command command = null;
// add a command to the map for that version
for (Map.Entry<Version, Map<Integer, Command>> entry : ALL_COMMANDS.entrySet()) {
Version version = entry.getKey();
// Get the current set of commands for this version.
Map<Integer, Command> commandMap = entry.getValue();
// See if we have a new command to insert into this map. Otherwise, keep using the command we
// have
// already read
Command newerVersion = versionToNewCommand.get(version);
if (newerVersion != null) {
command = newerVersion;
}
if (command != null) {
Command oldCommand = commandMap.get(messageType);
if (oldCommand != null && oldCommand != command) {
throw new InternalGemFireError("Command is already defined int the map for message Type " + MessageType.getString(messageType) + ". Old Value=" + commandMap.get(messageType) + ", newValue=" + command + ", version=" + version);
}
commandMap.put(messageType, command);
}
}
}
use of org.apache.geode.InternalGemFireError in project geode by apache.
the class AbstractGatewaySender method waitUntilFlushed.
public boolean waitUntilFlushed(long timeout, TimeUnit unit) throws InterruptedException {
boolean result = false;
if (isParallel()) {
try {
WaitUntilParallelGatewaySenderFlushedCoordinator coordinator = new WaitUntilParallelGatewaySenderFlushedCoordinator(this, timeout, unit, true);
result = coordinator.waitUntilFlushed();
} catch (BucketMovedException | CancelException | RegionDestroyedException e) {
logger.warn(LocalizedStrings.AbstractGatewaySender_CAUGHT_EXCEPTION_ATTEMPTING_WAIT_UNTIL_FLUSHED_RETRYING.toLocalizedString(), e);
throw e;
} catch (Throwable t) {
logger.warn(LocalizedStrings.AbstractGatewaySender_CAUGHT_EXCEPTION_ATTEMPTING_WAIT_UNTIL_FLUSHED_RETURNING.toLocalizedString(), t);
throw new InternalGemFireError(t);
}
return result;
} else {
// Serial senders are currently not supported
throw new UnsupportedOperationException(LocalizedStrings.AbstractGatewaySender_WAIT_UNTIL_FLUSHED_NOT_SUPPORTED_FOR_SERIAL_SENDERS.toLocalizedString());
}
}
use of org.apache.geode.InternalGemFireError in project geode by apache.
the class CheckTypeRegistryState method send.
public static void send(DM dm) {
Set recipients = dm.getOtherDistributionManagerIds();
ReplyProcessor21 replyProcessor = new ReplyProcessor21(dm, recipients);
CheckTypeRegistryState msg = new CheckTypeRegistryState(replyProcessor.getProcessorId());
msg.setRecipients(recipients);
dm.putOutgoing(msg);
try {
replyProcessor.waitForReplies();
} catch (ReplyException e) {
if (e.getCause() instanceof PdxInitializationException) {
throw new PdxInitializationException("Bad PDX configuration on member " + e.getSender() + ": " + e.getCause().getMessage(), e.getCause());
} else {
throw new InternalGemFireError("Unexpected exception", e);
}
} catch (InterruptedException e) {
throw new InternalGemFireError("Unexpected exception", e);
}
}
use of org.apache.geode.InternalGemFireError in project geode by apache.
the class PeerTypeRegistration method allocateTypeId.
private int allocateTypeId(PdxType newType) {
TXStateProxy currentState = suspendTX();
Region<Object, Object> r = getIdToType();
int id = newType.hashCode() & PLACE_HOLDER_FOR_TYPE_ID;
int newTypeId = id | this.dsId;
try {
int maxTry = maxTypeId;
while (r.get(newTypeId) != null) {
maxTry--;
if (maxTry == 0) {
throw new InternalGemFireError("Used up all of the PDX type ids for this distributed system. The maximum number of PDX types is " + maxTypeId);
}
// Find the next available type id.
id++;
if (id > this.maxTypeId) {
id = 1;
}
newTypeId = id | this.dsId;
}
return newTypeId;
} finally {
resumeTX(currentState);
}
}
Aggregations