use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class DistributedRegionFunctionResultSender method sendResult.
public synchronized void sendResult(Object oneResult) {
if (!this.functionObject.hasResult()) {
throw new IllegalStateException(LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE.toLocalizedString("send"));
}
if (this.sender != null) {
// Client-Server
sender.sendResult(oneResult);
} else {
if (isLocal) {
this.rc.addResult(dm.getDistributionManagerId(), oneResult);
FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReceived();
} else {
try {
this.msg.sendReplyForOneResult(dm, oneResult, false, enableOrderedResultStreming);
} catch (ForceReattemptException e) {
throw new FunctionException(e);
} catch (InterruptedException e) {
throw new FunctionException(e);
}
}
// incrementing result sent stats.
FunctionStats.getFunctionStats(functionObject.getId(), this.dm.getSystem()).incResultsReturned();
}
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class ParallelGatewaySenderQueue method peek.
// Need to improve here.If first peek returns NULL then look in another bucket.
@Override
public Object peek() throws InterruptedException, CacheException {
Object object = null;
int bucketId = -1;
PartitionedRegion prQ = getRandomShadowPR();
if (prQ != null && prQ.getDataStore().getAllLocalBucketRegions().size() > 0 && ((bucketId = getRandomPrimaryBucket(prQ)) != -1)) {
BucketRegionQueue brq;
try {
brq = ((BucketRegionQueue) prQ.getDataStore().getInitializedBucketForId(null, bucketId));
object = brq.peek();
} catch (BucketRegionQueueUnavailableException e) {
// since this is not set, it would be null
return object;
} catch (ForceReattemptException e) {
if (logger.isDebugEnabled()) {
logger.debug("Remove: Got ForceReattemptException for {} for bucke = {}", this, bucketId);
}
}
}
// OFFHEAP: ok since only callers uses it to check for empty queue
return object;
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class ParallelGatewaySenderQueue method destroyEventFromQueue.
private void destroyEventFromQueue(PartitionedRegion prQ, int bucketId, Object key) {
boolean isPrimary = prQ.getRegionAdvisor().getBucketAdvisor(bucketId).isPrimary();
BucketRegionQueue brq = getBucketRegionQueueByBucketId(prQ, bucketId);
// before destroying a key from it
try {
if (brq != null) {
brq.destroyKey(key);
}
stats.decQueueSize();
} catch (EntryNotFoundException e) {
if (!this.sender.isBatchConflationEnabled() && logger.isDebugEnabled()) {
logger.debug("ParallelGatewaySenderQueue#remove: Got EntryNotFoundException while removing key {} for {} for bucket = {} for GatewaySender {}", key, this, bucketId, this.sender);
}
} catch (ForceReattemptException e) {
if (logger.isDebugEnabled()) {
logger.debug("Bucket :{} moved to other member", bucketId);
}
} catch (PrimaryBucketException e) {
if (logger.isDebugEnabled()) {
logger.debug("Primary bucket :{} moved to other member", bucketId);
}
} catch (RegionDestroyedException e) {
if (logger.isDebugEnabled()) {
logger.debug("Caught RegionDestroyedException attempting to remove key {} from bucket {} in {}", key, bucketId, prQ.getFullPath());
}
}
addRemovedEvent(prQ, bucketId, key);
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class PartitionedTXRegionStub method containsKey.
public boolean containsKey(KeyInfo keyInfo) {
PartitionedRegion pr = (PartitionedRegion) region;
try {
boolean retVal = pr.containsKeyRemotely((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;
}
}
use of org.apache.geode.internal.cache.ForceReattemptException in project geode by apache.
the class PartitionedTXRegionStub method putEntry.
public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) {
boolean retVal = false;
final LocalRegion r = event.getLocalRegion();
PartitionedRegion pr = (PartitionedRegion) r;
try {
retVal = pr.putRemotely(state.getTarget(), event, ifNew, ifOld, expectedOldValue, requireOldValue);
} catch (TransactionException e) {
RuntimeException re = getTransactionException(event.getKeyInfo(), e);
re.initCause(e.getCause());
throw re;
} catch (PrimaryBucketException e) {
RuntimeException re = getTransactionException(event.getKeyInfo(), e);
re.initCause(e);
throw re;
} catch (ForceReattemptException e) {
waitToRetry();
RuntimeException re = getTransactionException(event.getKeyInfo(), e);
re.initCause(e);
throw re;
}
trackBucketForTx(event.getKeyInfo());
return retVal;
}
Aggregations