Search in sources :

Example 11 with TransactionDataNodeHasDepartedException

use of org.apache.geode.cache.TransactionDataNodeHasDepartedException in project geode by apache.

the class DistributedTXRegionStub method postRemoveAll.

@Override
public void postRemoveAll(DistributedRemoveAllOperation op, VersionedObjectList successfulOps, LocalRegion region) {
    try {
        RemoteRemoveAllMessage.RemoveAllResponse response = RemoteRemoveAllMessage.send(state.getTarget(), op.getBaseEvent(), op.getRemoveAllEntryData(), op.getRemoveAllEntryData().length, true, DistributionManager.PARTITIONED_REGION_EXECUTOR, false);
        response.waitForCacheException();
    } catch (RegionDestroyedException rde) {
        throw new TransactionDataNotColocatedException(LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION.toLocalizedString(rde.getRegionFullPath()), rde);
    } catch (RemoteOperationException roe) {
        throw new TransactionDataNodeHasDepartedException(roe);
    }
}
Also used : RemoteRemoveAllMessage(org.apache.geode.internal.cache.RemoteRemoveAllMessage) RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) TransactionDataNotColocatedException(org.apache.geode.cache.TransactionDataNotColocatedException) RemoteOperationException(org.apache.geode.internal.cache.RemoteOperationException) TransactionDataNodeHasDepartedException(org.apache.geode.cache.TransactionDataNodeHasDepartedException)

Example 12 with TransactionDataNodeHasDepartedException

use of org.apache.geode.cache.TransactionDataNodeHasDepartedException in project geode by apache.

the class DistributedTXRegionStub method invalidateExistingEntry.

public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) {
    try {
        RemoteOperationResponse response = RemoteInvalidateMessage.send(state.getTarget(), event.getRegion(), event, DistributionManager.PARTITIONED_REGION_EXECUTOR, true, false);
        response.waitForCacheException();
    } catch (RegionDestroyedException rde) {
        throw new TransactionDataNotColocatedException(LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION.toLocalizedString(rde.getRegionFullPath()), rde);
    } catch (RemoteOperationException roe) {
        throw new TransactionDataNodeHasDepartedException(roe);
    }
}
Also used : RegionDestroyedException(org.apache.geode.cache.RegionDestroyedException) TransactionDataNotColocatedException(org.apache.geode.cache.TransactionDataNotColocatedException) RemoteOperationException(org.apache.geode.internal.cache.RemoteOperationException) RemoteOperationResponse(org.apache.geode.internal.cache.RemoteOperationMessage.RemoteOperationResponse) TransactionDataNodeHasDepartedException(org.apache.geode.cache.TransactionDataNodeHasDepartedException)

Example 13 with TransactionDataNodeHasDepartedException

use of org.apache.geode.cache.TransactionDataNodeHasDepartedException 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;
    }
}
Also used : TransactionException(org.apache.geode.cache.TransactionException) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) PrimaryBucketException(org.apache.geode.internal.cache.PrimaryBucketException) TransactionDataNodeHasDepartedException(org.apache.geode.cache.TransactionDataNodeHasDepartedException)

Example 14 with TransactionDataNodeHasDepartedException

use of org.apache.geode.cache.TransactionDataNodeHasDepartedException in project geode by apache.

the class PartitionedTXRegionStub method destroyExistingEntry.

public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) {
    PartitionedRegion pr = (PartitionedRegion) event.getLocalRegion();
    try {
        pr.destroyRemotely(state.getTarget(), event.getKeyInfo().getBucketId(), event, expectedOldValue);
    } 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) {
        RuntimeException re;
        if (isBucketNotFoundException(e)) {
            re = new TransactionDataRebalancedException(LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING.toLocalizedString());
        } else {
            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);
        waitToRetry();
        throw re;
    }
    trackBucketForTx(event.getKeyInfo());
}
Also used : TransactionException(org.apache.geode.cache.TransactionException) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) PrimaryBucketException(org.apache.geode.internal.cache.PrimaryBucketException) TransactionDataRebalancedException(org.apache.geode.cache.TransactionDataRebalancedException) TransactionDataNodeHasDepartedException(org.apache.geode.cache.TransactionDataNodeHasDepartedException)

Example 15 with TransactionDataNodeHasDepartedException

use of org.apache.geode.cache.TransactionDataNodeHasDepartedException in project geode by apache.

the class PartitionedTXRegionStub method invalidateExistingEntry.

public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) {
    PartitionedRegion pr = (PartitionedRegion) event.getLocalRegion();
    try {
        pr.invalidateRemotely(state.getTarget(), event.getKeyInfo().getBucketId(), event);
    } 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) {
        RuntimeException re;
        if (isBucketNotFoundException(e)) {
            re = new TransactionDataRebalancedException(LocalizedStrings.PartitionedRegion_TRANSACTIONAL_DATA_MOVED_DUE_TO_REBALANCING.toLocalizedString());
        } else {
            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);
        waitToRetry();
        throw re;
    }
    trackBucketForTx(event.getKeyInfo());
}
Also used : TransactionException(org.apache.geode.cache.TransactionException) ForceReattemptException(org.apache.geode.internal.cache.ForceReattemptException) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) PrimaryBucketException(org.apache.geode.internal.cache.PrimaryBucketException) TransactionDataRebalancedException(org.apache.geode.cache.TransactionDataRebalancedException) TransactionDataNodeHasDepartedException(org.apache.geode.cache.TransactionDataNodeHasDepartedException)

Aggregations

TransactionDataNodeHasDepartedException (org.apache.geode.cache.TransactionDataNodeHasDepartedException)15 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)6 TransactionDataNotColocatedException (org.apache.geode.cache.TransactionDataNotColocatedException)6 RemoteOperationException (org.apache.geode.internal.cache.RemoteOperationException)6 TransactionException (org.apache.geode.cache.TransactionException)5 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)5 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)5 PrimaryBucketException (org.apache.geode.internal.cache.PrimaryBucketException)5 TransactionDataRebalancedException (org.apache.geode.cache.TransactionDataRebalancedException)3 TXId (org.apache.geode.internal.cache.TXId)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Cache (org.apache.geode.cache.Cache)2 CacheException (org.apache.geode.cache.CacheException)2 CacheTransactionManager (org.apache.geode.cache.CacheTransactionManager)2 EntryNotFoundException (org.apache.geode.cache.EntryNotFoundException)2 Execution (org.apache.geode.cache.execute.Execution)2 FunctionException (org.apache.geode.cache.execute.FunctionException)2 DistributedMember (org.apache.geode.distributed.DistributedMember)2 PartitionedRegionException (org.apache.geode.internal.cache.PartitionedRegionException)2