use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class BucketSizeMessage method operateOnPartitionedRegion.
@Override
protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException {
PartitionedRegionDataStore ds = r.getDataStore();
final long size;
if (ds != null) {
size = ds.getBucketSize(bucketId);
} else {
// sender thought this member had a data store, but it doesn't
throw new ForceReattemptException(LocalizedStrings.BucketSizeMessage_NO_DATASTORE_IN_0.toLocalizedString(dm.getDistributionManagerId()));
}
r.getPrStats().endPartitionMessagesProcessing(startTime);
BucketSizeReplyMessage.send(getSender(), getProcessorId(), dm, size);
return false;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class ContainsKeyValueMessage method operateOnPartitionedRegion.
@Override
protected boolean operateOnPartitionedRegion(DistributionManager dm, PartitionedRegion r, long startTime) throws CacheException, ForceReattemptException {
PartitionedRegionDataStore ds = r.getDataStore();
final boolean replyVal;
if (ds != null) {
try {
if (this.valueCheck) {
replyVal = ds.containsValueForKeyLocally(this.bucketId, this.key);
} else {
replyVal = ds.containsKeyLocally(this.bucketId, this.key);
}
} catch (PRLocallyDestroyedException pde) {
throw new ForceReattemptException(LocalizedStrings.ContainsKeyValueMessage_ENOUNTERED_PRLOCALLYDESTROYEDEXCEPTION.toLocalizedString(), pde);
}
r.getPrStats().endPartitionMessagesProcessing(startTime);
ContainsKeyValueReplyMessage.send(getSender(), getProcessorId(), getReplySender(dm), replyVal);
} else {
logger.fatal(LocalizedMessage.create(LocalizedStrings.ContainsKeyValueMess_PARTITIONED_REGION_0_IS_NOT_CONFIGURED_TO_STORE_DATA, r.getFullPath()));
ForceReattemptException fre = new ForceReattemptException(LocalizedStrings.ContainsKeyValueMessage_PARTITIONED_REGION_0_ON_1_IS_NOT_CONFIGURED_TO_STORE_DATA.toLocalizedString(new Object[] { r.getFullPath(), dm.getId() }));
fre.setHash(key.hashCode());
throw fre;
}
// response
return false;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class CreateBucketMessage method send.
/**
* Sends a PartitionedRegion manage bucket request to the recipient
*
* @param recipient the member to which the bucket manage request is sent
* @param r the PartitionedRegion to which the bucket belongs
* @param bucketId the unique identifier of the bucket
* @param bucketSize the size in bytes of the bucket
* @return the processor used to fetch the returned Node if any
* @throws ForceReattemptException if the peer is no longer available
*/
public static NodeResponse send(InternalDistributedMember recipient, PartitionedRegion r, int bucketId, int bucketSize) throws ForceReattemptException {
Assert.assertTrue(recipient != null, "CreateBucketMessage NULL recipient");
NodeResponse p = new NodeResponse(r.getSystem(), recipient);
CreateBucketMessage m = new CreateBucketMessage(recipient, r.getPRId(), p, bucketId, bucketSize);
p.enableSevereAlertProcessing();
Set failures = r.getDistributionManager().putOutgoing(m);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException("Failed sending <" + m + ">");
}
return p;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class DestroyMessage method send.
/**
* Sends a DestroyMessage {@link org.apache.geode.cache.Region#destroy(Object)}message to the
* recipient
*
* @param recipient the recipient of the message
* @param r the PartitionedRegion for which the destroy was performed
* @param event the event causing this message
* @return the processor used to await the potential {@link org.apache.geode.cache.CacheException}
* @throws ForceReattemptException if the peer is no longer available
*/
public static DestroyResponse send(DistributedMember recipient, PartitionedRegion r, EntryEventImpl event, Object expectedOldValue) throws ForceReattemptException {
// Assert.assertTrue(recipient != null, "DestroyMessage NULL recipient"); recipient may be null
// for event notification
Set recipients = Collections.singleton(recipient);
DestroyResponse p = new DestroyResponse(r.getSystem(), recipients, false);
p.requireResponse();
DestroyMessage m = new DestroyMessage(recipients, false, r.getPRId(), p, event, expectedOldValue);
m.setTransactionDistributed(r.getCache().getTxManager().isDistributed());
Set failures = r.getDistributionManager().putOutgoing(m);
if (failures != null && failures.size() > 0) {
throw new ForceReattemptException(LocalizedStrings.DestroyMessage_FAILED_SENDING_0.toLocalizedString(m));
}
return p;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class PartitionedTXRegionStub method containsValueForKey.
public boolean containsValueForKey(KeyInfo keyInfo) {
PartitionedRegion pr = (PartitionedRegion) region;
try {
boolean retVal = pr.containsValueForKeyRemotely((InternalDistributedMember) state.getTarget(), keyInfo.getBucketId(), keyInfo.getKey());
trackBucketForTx(keyInfo);
return retVal;
} catch (TransactionException e) {
RuntimeException re = getTransactionException(keyInfo, e);
re.initCause(e.getCause());
throw re;
} catch (PrimaryBucketException e) {
RuntimeException re = getTransactionException(keyInfo, e);
re.initCause(e);
throw re;
} catch (ForceReattemptException e) {
if (isBucketNotFoundException(e)) {
RuntimeException re = getTransactionException(keyInfo, e);
re.initCause(e);
throw re;
}
waitToRetry();
RuntimeException re = new TransactionDataNodeHasDepartedException(LocalizedStrings.PartitionedRegion_TRANSACTION_DATA_NODE_0_HAS_DEPARTED_TO_PROCEED_ROLLBACK_THIS_TRANSACTION_AND_BEGIN_A_NEW_ONE.toLocalizedString(state.getTarget()));
re.initCause(e);
throw re;
}
}
Aggregations