use of org.apache.geode.distributed.internal.ReplyException 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.distributed.internal.ReplyException in project geode by apache.
the class CheckTypeRegistryState method process.
@Override
protected void process(DistributionManager dm) {
ReplyException e = null;
try {
InternalCache cache = GemFireCacheImpl.getInstance();
if (cache != null && !cache.isClosed()) {
TypeRegistry pdxRegistry = cache.getPdxRegistry();
if (pdxRegistry != null) {
TypeRegistration registry = pdxRegistry.getTypeRegistration();
if (registry instanceof PeerTypeRegistration) {
PeerTypeRegistration peerRegistry = (PeerTypeRegistration) registry;
peerRegistry.verifyConfiguration();
}
}
}
} catch (Exception ex) {
e = new ReplyException(ex);
} finally {
ReplyMessage rm = new ReplyMessage();
rm.setException(e);
rm.setProcessorId(processorId);
rm.setRecipient(getSender());
dm.putOutgoing(rm);
}
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class PersistentPartitionedRegionDUnitTest method testRevokeBeforeStartup.
// GEODE-974: async actions, time sensitive, 65 second timeouts
@Category(FlakyTest.class)
@Test
public void testRevokeBeforeStartup() throws Throwable {
IgnoredException.addIgnoredException("RevokeFailedException");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
int numBuckets = 50;
createPR(vm0, 1);
createPR(vm1, 1);
createData(vm0, 0, numBuckets, "a");
Set<Integer> vm0Buckets = getBucketList(vm0);
Set<Integer> vm1Buckets = getBucketList(vm1);
assertEquals(vm0Buckets, vm1Buckets);
// This should fail with a revocation failed message
try {
revokeAllMembers(vm2);
fail("The revoke should have failed, because members are running");
} catch (RMIException e) {
if (!(e.getCause() instanceof ReplyException && e.getCause().getCause() instanceof RevokeFailedException)) {
throw e;
}
}
closeCache(vm0);
createData(vm1, 0, numBuckets, "b");
File vm1Directory = getDiskDirectory(vm1);
closeCache(vm1);
vm0.invoke(new SerializableRunnable("get cache") {
public void run() {
getCache();
}
});
revokeMember(vm2, vm1Directory);
AsyncInvocation a1 = createPRAsync(vm0, 1);
a1.getResult(MAX_WAIT);
assertEquals(vm0Buckets, getBucketList(vm0));
checkData(vm0, 0, numBuckets, "a");
createData(vm0, numBuckets, 113, "b");
checkData(vm0, numBuckets, 113, "b");
IgnoredException ex = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getName(), vm1);
try {
createPR(vm1, 1);
fail("Should have recieved a SplitDistributedSystemException");
} catch (RMIException e) {
// We revoked this member.
if (!(e.getCause() instanceof RevokedPersistentDataException)) {
throw e;
}
}
ex.remove();
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class TXLockServiceImpl method updateParticipants.
@Override
public void updateParticipants(TXLockId txLockId, final Set updatedParticipants) {
synchronized (this.txLockIdList) {
if (!this.txLockIdList.contains(txLockId)) {
throw new IllegalArgumentException(LocalizedStrings.TXLockServiceImpl_INVALID_TXLOCKID_NOT_FOUND_0.toLocalizedString(txLockId));
}
}
if (updatedParticipants == null) {
throw new IllegalArgumentException(LocalizedStrings.TXLockServiceImpl_INVALID_UPDATEDPARTICIPANTS_NULL.toLocalizedString());
}
if (updatedParticipants.isEmpty()) {
return;
}
if (!this.recovering) {
// Serializable grantorId = this.dlock.getLockGrantorId();
if (this.dlock.isLockGrantor()) {
// Don't need to send a message (or wait for a reply)
// logger.info("DEBUG: [TXLockServiceImpl.updateParticipants] this VM is the Grantor");
TXLockUpdateParticipantsMessage.updateParticipants(this.dlock, txLockId, updatedParticipants);
} else {
// not lock grantor
LockGrantorId lockGrantorId = txLockId.getLockGrantorId();
if (lockGrantorId == null || !this.dlock.isLockGrantorId(lockGrantorId)) {
// grantor is gone so we cannot update him
return;
}
InternalDistributedMember grantorId = lockGrantorId.getLockGrantorMember();
// logger.info("DEBUG: [TXLockServiceImpl.updateParticipants] sending update message to
// Grantor " + grantorId);
ReplyProcessor21 processor = new ReplyProcessor21(this.dlock.getDistributionManager(), grantorId);
TXLockUpdateParticipantsMessage dlup = new TXLockUpdateParticipantsMessage(txLockId, this.dlock.getName(), updatedParticipants, processor.getProcessorId());
dlup.setRecipient(grantorId);
this.dlock.getDistributionManager().putOutgoing(dlup);
// for() loop removed for bug 36983 - you can't loop on waitForReplies()
this.dlock.getDistributionManager().getCancelCriterion().checkCancelInProgress(null);
try {
processor.waitForRepliesUninterruptibly();
} catch (ReplyException e) {
e.handleAsUnexpected();
}
}
// not lock grantor
}
// not recovering
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class TXOriginatorRecoveryProcessor method sendMessage.
static void sendMessage(Set members, InternalDistributedMember originator, TXLockId txLockId, DLockGrantor grantor, DM dm) {
TXOriginatorRecoveryProcessor processor = new TXOriginatorRecoveryProcessor(dm, members);
TXOriginatorRecoveryMessage msg = new TXOriginatorRecoveryMessage();
msg.processorId = processor.getProcessorId();
msg.txLockId = txLockId;
// send msg to all members EXCEPT this member...
Set recipients = new HashSet(members);
recipients.remove(dm.getId());
msg.setRecipients(members);
if (logger.isDebugEnabled()) {
logger.debug("Sending TXOriginatorRecoveryMessage: {}", msg);
}
dm.putOutgoing(msg);
// process msg and reply directly if this VM is a participant...
if (members.contains(dm.getId())) {
if (msg.getSender() == null)
msg.setSender(dm.getId());
msg.process((DistributionManager) dm);
}
// keep waiting even if interrupted
// for() loop removed for bug 36983 - you can't loop on waitForReplies()
dm.getCancelCriterion().checkCancelInProgress(null);
try {
processor.waitForRepliesUninterruptibly();
} catch (ReplyException e) {
e.handleAsUnexpected();
}
// release txLockId...
if (logger.isDebugEnabled()) {
logger.debug("TXOriginatorRecoveryProcessor releasing: {}", txLockId);
}
// dtls.release(txLockId);
try {
grantor.releaseLockBatch(txLockId, originator);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
Aggregations