use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class PutAllPRMessage method send.
/**
* Sends a PartitionedRegion PutAllPRMessage to the recipient
*
* @param recipient the member to which the put message is sent
* @param r the PartitionedRegion for which the put was performed
* @return the processor used to await acknowledgement that the update was sent, or null to
* indicate that no acknowledgement will be sent
* @throws ForceReattemptException if the peer is no longer available
*/
public PartitionResponse send(DistributedMember recipient, PartitionedRegion r) throws ForceReattemptException {
// Assert.assertTrue(recipient != null, "PutAllPRMessage NULL recipient"); recipient can be null
// for event notifications
Set recipients = Collections.singleton(recipient);
PutAllResponse p = new PutAllResponse(r.getSystem(), recipients);
initMessage(r, recipients, false, p);
setTransactionDistributed(r.getCache().getTxManager().isDistributed());
if (logger.isDebugEnabled()) {
logger.debug("PutAllPRMessage.send: recipient is {}, msg is {}", recipient, this);
}
Set failures = r.getDistributionManager().putOutgoing(this);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException("Failed sending <" + this + ">");
}
return p;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class FetchEntriesMessage method send.
/**
* Sends a PartitionedRegion message to fetch all the entries for a bucketId
*
* @param recipient the member that the fetch keys message is sent to
* @param r the PartitionedRegion that contains the bucket
* @param bucketId the identity of the bucket that contains the entries to be returned
* @return the processor used to read the returned entries
* @throws ForceReattemptException if the peer is no longer available
*/
public static FetchEntriesResponse send(InternalDistributedMember recipient, PartitionedRegion r, int bucketId) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "FetchEntriesMessage NULL reply message");
FetchEntriesResponse p = new FetchEntriesResponse(r.getSystem(), r, recipient, bucketId);
FetchEntriesMessage m = new FetchEntriesMessage(recipient, r.getPRId(), p, bucketId);
Set failures = r.getDistributionManager().putOutgoing(m);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException(LocalizedStrings.FetchEntriesMessage_FAILED_SENDING_0.toLocalizedString(m));
}
return p;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class FetchEntryMessage method operateOnPartitionedRegion.
@Override
protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws ForceReattemptException {
// FetchEntryMessage is used in refreshing client caches during interest list recovery,
// so don't be too verbose or hydra tasks may time out
PartitionedRegionDataStore ds = r.getDataStore();
EntrySnapshot val;
if (ds != null) {
try {
KeyInfo keyInfo = r.getKeyInfo(key);
val = (EntrySnapshot) r.getDataView().getEntryOnRemote(keyInfo, r, true);
r.getPrStats().endPartitionMessagesProcessing(startTime);
FetchEntryReplyMessage.send(getSender(), getProcessorId(), val, dm, null);
} catch (TransactionException tex) {
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(tex));
} catch (PRLocallyDestroyedException pde) {
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(new ForceReattemptException(LocalizedStrings.FetchEntryMessage_ENCOUNTERED_PRLOCALLYDESTROYED.toLocalizedString(), pde)));
} catch (EntryNotFoundException enfe) {
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(LocalizedStrings.FetchEntryMessage_ENTRY_NOT_FOUND.toLocalizedString(), enfe));
} catch (PrimaryBucketException pbe) {
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(pbe));
} catch (ForceReattemptException pbe) {
pbe.checkKey(key);
// Slightly odd -- we're marshalling the retry to the peer on another host...
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(pbe));
} catch (DataLocationException e) {
FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(e));
}
} else {
throw new InternalGemFireError(LocalizedStrings.FetchEntryMessage_FETCHENTRYMESSAGE_MESSAGE_SENT_TO_WRONG_MEMBER.toLocalizedString());
}
// response
return false;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class FetchKeysMessage method operateOnPartitionedRegion.
@Override
protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException {
if (logger.isDebugEnabled()) {
logger.debug("FetchKeysMessage operateOnRegion: {} bucketId: {} type: {} {}", r.getFullPath(), this.bucketId, InterestType.getString(interestType), (allowTombstones ? " with tombstones" : " without tombstones"));
}
PartitionedRegionDataStore ds = r.getDataStore();
if (ds != null) {
try {
Set keys = ds.handleRemoteGetKeys(this.bucketId, interestType, interestArg, allowTombstones);
if (logger.isTraceEnabled(LogMarker.DM)) {
logger.debug("FetchKeysMessage sending {} keys back using processorId: : {}", keys.size(), getProcessorId(), keys);
}
r.getPrStats().endPartitionMessagesProcessing(startTime);
FetchKeysReplyMessage.send(getSender(), getProcessorId(), dm, keys);
} catch (PRLocallyDestroyedException pde) {
if (logger.isDebugEnabled()) {
logger.debug("FetchKeysMessage Encountered PRLocallyDestroyedException");
}
throw new ForceReattemptException(LocalizedStrings.FetchKeysMessage_ENCOUNTERED_PRLOCALLYDESTROYEDEXCEPTION.toLocalizedString(), pde);
}
} else {
logger.warn(LocalizedMessage.create(LocalizedStrings.FetchKeysMessage_FETCHKEYSMESSAGE_DATA_STORE_NOT_CONFIGURED_FOR_THIS_MEMBER));
}
// Unless there was an exception thrown, this message handles sending the response
return false;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class ContainsKeyValueMessage method send.
/**
* Sends a PartitionedRegion message for either
* {@link org.apache.geode.cache.Region#containsKey(Object)}or
* {@link org.apache.geode.cache.Region#containsValueForKey(Object)} depending on the
* <code>valueCheck</code> argument
*
* @param recipient the member that the contains keys/value message is sent to
* @param r the PartitionedRegion that contains the bucket
* @param key the key to be queried
* @param bucketId the identity of the bucket to be queried
* @param valueCheck true if {@link org.apache.geode.cache.Region#containsValueForKey(Object)} is
* desired, false if {@link org.apache.geode.cache.Region#containsKey(Object)}is desired
* @return the processor used to read the returned keys
* @throws ForceReattemptException if the peer is no longer available
*/
public static ContainsKeyValueResponse send(InternalDistributedMember recipient, PartitionedRegion r, Object key, Integer bucketId, boolean valueCheck) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "PRDistribuedContainsKeyValueMessage NULL reply message");
ContainsKeyValueResponse p = new ContainsKeyValueResponse(r.getSystem(), Collections.singleton(recipient), key);
ContainsKeyValueMessage m = new ContainsKeyValueMessage(recipient, r.getPRId(), p, key, bucketId, valueCheck);
Set failures = r.getDistributionManager().putOutgoing(m);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException(LocalizedStrings.ContainsKeyValueMessage_FAILED_SENDING_0.toLocalizedString(m));
}
return p;
}
Aggregations