use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class RemoteGetMessage method operateOnRegion.
@Override
protected boolean operateOnRegion(final DistributionManager dm, LocalRegion r, long startTime) throws RemoteOperationException {
if (logger.isTraceEnabled(LogMarker.DM)) {
logger.trace(LogMarker.DM, "RemoteGetMessage operateOnRegion: {}", r.getFullPath());
}
if (this.getTXUniqId() != TXManagerImpl.NOTX) {
assert r.getDataView() instanceof TXStateProxy;
}
if (!(r instanceof PartitionedRegion)) {
// prs already wait on initialization
// bug #43371 - accessing a region before it's initialized
r.waitOnInitialization();
}
RawValue valueBytes;
Object val = null;
try {
KeyInfo keyInfo = r.getKeyInfo(key, cbArg);
val = r.getDataView().getSerializedValue(r, keyInfo, false, this.context, null, false);
valueBytes = val instanceof RawValue ? (RawValue) val : new RawValue(val);
if (logger.isTraceEnabled(LogMarker.DM)) {
logger.trace(LogMarker.DM, "GetMessage sending serialized value {} back via GetReplyMessage using processorId: {}", valueBytes, getProcessorId());
}
// r.getPrStats().endPartitionMessagesProcessing(startTime);
GetReplyMessage.send(getSender(), getProcessorId(), valueBytes, getReplySender(dm));
// response
return false;
} catch (DistributedSystemDisconnectedException sde) {
sendReply(getSender(), this.processorId, dm, new ReplyException(new RemoteOperationException(LocalizedStrings.GetMessage_OPERATION_GOT_INTERRUPTED_DUE_TO_SHUTDOWN_IN_PROGRESS_ON_REMOTE_VM.toLocalizedString(), sde)), r, startTime);
return false;
} catch (PrimaryBucketException pbe) {
sendReply(getSender(), getProcessorId(), dm, new ReplyException(pbe), r, startTime);
return false;
} catch (DataLocationException e) {
sendReply(getSender(), getProcessorId(), dm, new ReplyException(e), r, startTime);
return false;
} finally {
OffHeapHelper.release(val);
}
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class RemotePutAllMessage method operateOnRegion.
@Override
protected boolean operateOnRegion(DistributionManager dm, LocalRegion r, long startTime) throws RemoteOperationException {
final boolean sendReply;
InternalDistributedMember eventSender = getSender();
long lastModified = 0L;
try {
sendReply = doLocalPutAll(r, eventSender, lastModified);
} catch (RemoteOperationException e) {
sendReply(getSender(), getProcessorId(), dm, new ReplyException(e), r, startTime);
return false;
}
if (sendReply) {
sendReply(getSender(), getProcessorId(), dm, null, r, startTime);
}
return false;
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class DLockRecoverGrantorProcessor method recoverLockGrantor.
// -------------------------------------------------------------------------
// Static operations for recovering from loss of the lock grantor
// -------------------------------------------------------------------------
/**
* Sends DLockRecoverGrantorMessage to all participants of the DLockService in order to recover
* from the loss of the previous lock grantor. Each member will reply with details on currently
* held locks, pending locks, and known stuck locks.
* <p>
* This method should block until transfer of lock grantor has completed.
*/
static boolean recoverLockGrantor(Set members, DLockService service, DLockGrantor newGrantor, DM dm, InternalDistributedMember elder) {
// proc will wait for replies from everyone including THIS member...
DLockRecoverGrantorProcessor processor = new DLockRecoverGrantorProcessor(dm, members, newGrantor);
DLockRecoverGrantorMessage msg = new DLockRecoverGrantorMessage();
msg.serviceName = service.getName();
msg.processorId = processor.getProcessorId();
msg.grantorVersion = newGrantor.getVersionId();
msg.grantorSerialNumber = service.getSerialNumber();
msg.elder = elder;
// send msg to all members EXCEPT this member...
Set recipients = new HashSet(members);
recipients.remove(dm.getId());
if (!recipients.isEmpty()) {
msg.setRecipients(recipients);
dm.putOutgoing(msg);
}
// process msg and reply from this VM...
if (msg.getSender() == null)
msg.setSender(dm.getId());
msg.scheduleMessage(dm);
// keep waiting even if interrupted
try {
processor.waitForRepliesUninterruptibly();
} catch (ReplyException e) {
e.handleAsUnexpected();
}
if (processor.error) {
return false;
}
// return newGrantor.makeReady(false);
return true;
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class DLockReleaseProcessor method release.
/**
* Returns true if release was acknowledged by the grantor; false means we targeted someone who is
* not the grantor
*/
protected boolean release(InternalDistributedMember grantor, String serviceName, boolean lockBatch, int lockId) {
DM dm = getDistributionManager();
DLockReleaseMessage msg = new DLockReleaseMessage();
msg.processorId = getProcessorId();
msg.serviceName = serviceName;
msg.objectName = this.objectName;
msg.lockBatch = lockBatch;
msg.lockId = lockId;
msg.setRecipient(grantor);
if (grantor.equals(dm.getId())) {
// local... don't message...
msg.setSender(grantor);
msg.processLocally(dm);
} else {
dm.putOutgoing(msg);
}
// keep waiting even if interrupted
try {
waitForRepliesUninterruptibly();
} catch (ReplyException e) {
e.handleAsUnexpected();
}
if (this.reply == null)
return false;
return this.reply.replyCode == DLockReleaseReplyMessage.OK;
}
use of org.apache.geode.distributed.internal.ReplyException in project geode by apache.
the class MissingPersistentIDsRequest method send.
public static Set<PersistentID> send(DM dm) {
Set recipients = dm.getOtherDistributionManagerIds();
MissingPersistentIDsRequest request = new MissingPersistentIDsRequest();
request.setRecipients(recipients);
MissingPersistentIDProcessor replyProcessor = new MissingPersistentIDProcessor(dm, recipients);
request.msgId = replyProcessor.getProcessorId();
dm.putOutgoing(request);
try {
replyProcessor.waitForReplies();
} catch (ReplyException e) {
if (!(e.getCause() instanceof CancelException)) {
throw e;
}
} catch (InterruptedException e) {
logger.warn(e);
}
Set<PersistentID> results = replyProcessor.missing;
Set<PersistentID> existing = replyProcessor.existing;
MissingPersistentIDsResponse localResponse = (MissingPersistentIDsResponse) request.createResponse((DistributionManager) dm);
results.addAll(localResponse.getMissingIds());
existing.addAll(localResponse.getLocalIds());
results.removeAll(existing);
return results;
}
Aggregations