/** * Returns true if the operation may be distributed. */ public boolean isDistributed() { return !isLocal(); }
/** * Check INVALIDATE Operation. */ @Test public void testINVALIDATE() { Operation op = Operation.INVALIDATE; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertTrue(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertFalse(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertFalse(op.isRegion()); assertFalse(op.isLocal()); assertTrue(op.isDistributed()); assertTrue(op.isEntry()); assertFalse(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
/** * Check DESTROY Operation. */ @Test public void testDESTROY() { Operation op = Operation.DESTROY; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertFalse(op.isInvalidate()); assertTrue(op.isDestroy()); assertFalse(op.isPutAll()); assertFalse(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertFalse(op.isRegion()); assertFalse(op.isLocal()); assertTrue(op.isDistributed()); assertTrue(op.isEntry()); assertFalse(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
@Override public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) { if (event.getOperation().isLocal()) { throw new UnsupportedOperationInTransactionException(); } proxy.invalidate(event); }
/** * Check REGION_CREATE Operation. */ @Test public void testREGION_CREATE() { Operation op = Operation.REGION_CREATE; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertFalse(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertFalse(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertTrue(op.isRegion()); assertTrue(op.isLocal()); assertFalse(op.isDistributed()); assertFalse(op.isEntry()); assertFalse(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
@Override protected boolean shouldGenerateVersionTag(RegionEntry entry, EntryEventImpl event) { if (event.getOperation().isLocal()) { // bug #45402 - localDestroy generated a version tag return false; } return this.getConcurrencyChecksEnabled() && ((event.getVersionTag() == null) || event.getVersionTag().isGatewayTag()); }
/** * Check EXPIRE_LOCAL_INVALIDATE Operation. */ @Test public void testEXPIRE_LOCAL_INVALIDATE() { Operation op = Operation.EXPIRE_LOCAL_INVALIDATE; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertTrue(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertFalse(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertFalse(op.isRegion()); assertTrue(op.isLocal()); assertFalse(op.isDistributed()); assertTrue(op.isEntry()); assertTrue(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
@Override public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) { if (event.getOperation().isLocal()) { throw new UnsupportedOperationInTransactionException( "localInvalidate() is not allowed in a transaction"); } getTXRegionStub(event.getRegion()).invalidateExistingEntry(event, invokeCallbacks, forceNewEntry); }
/** * Check REGION_EXPIRE_INVALIDATE Operation. */ @Test public void testREGION_EXPIRE_INVALIDATE() { Operation op = Operation.REGION_EXPIRE_INVALIDATE; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertFalse(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertTrue(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertTrue(op.isRegion()); assertFalse(op.isLocal()); assertTrue(op.isDistributed()); assertFalse(op.isEntry()); assertTrue(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
/** * returns true if it is okay to process this event even though it has a null version */ public boolean noVersionReceivedFromServer() { return versionTag == null && getRegion().getConcurrencyChecksEnabled() && getRegion().getServerProxy() != null && !op.isLocal() && !isOriginRemote(); }
/** * Check NET_LOAD_CREATE Operation. */ @Test public void testNET_LOAD_CREATE() { Operation op = Operation.NET_LOAD_CREATE; assertTrue(op.isCreate()); assertFalse(op.isUpdate()); assertFalse(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertFalse(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertFalse(op.isRegion()); assertFalse(op.isLocal()); assertTrue(op.isDistributed()); assertTrue(op.isEntry()); assertFalse(op.isExpiration()); assertFalse(op.isLocalLoad()); assertTrue(op.isNetLoad()); assertTrue(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
@Override public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) throws EntryNotFoundException { if (event.getOperation().isLocal()) { throw new UnsupportedOperationInTransactionException( "localDestroy() is not allowed in a transaction"); } TXRegionStub rs = getTXRegionStub(event.getRegion()); rs.destroyExistingEntry(event, cacheWrite, expectedOldValue); }
/** * Check REGION_LOCAL_INVALIDATE Operation. */ @Test public void testREGION_LOCAL_INVALIDATE() { Operation op = Operation.REGION_LOCAL_INVALIDATE; assertFalse(op.isCreate()); assertFalse(op.isUpdate()); assertFalse(op.isInvalidate()); assertFalse(op.isDestroy()); assertFalse(op.isPutAll()); assertTrue(op.isRegionInvalidate()); assertFalse(op.isRegionDestroy()); assertTrue(op.isRegion()); assertTrue(op.isLocal()); assertFalse(op.isDistributed()); assertFalse(op.isEntry()); assertFalse(op.isExpiration()); assertFalse(op.isLocalLoad()); assertFalse(op.isNetLoad()); assertFalse(op.isLoad()); assertFalse(op.isNetSearch()); assertFalse(op.isClose()); assertFalse(op.isClear()); }
@Override public boolean destroy(EntryEventImpl event, boolean inTokenMode, boolean duringRI, boolean cacheWrite, boolean isEviction, Object expectedOldValue, boolean removeRecoveredEntry) throws CacheWriterException, EntryNotFoundException, TimeoutException { if (event.getOperation().isLocal()) { throw new EntryNotFoundException(event.getKey().toString()); } if (cacheWrite) { this.owner.cacheWriteBeforeDestroy(event, expectedOldValue); } owner.recordEvent(event); this.owner.basicDestroyPart2(markerEntry, event, inTokenMode, false /* Clear conflict occurred */, duringRI, true); this.owner.basicDestroyPart3(markerEntry, event, inTokenMode, duringRI, true, expectedOldValue); return true; }
@Override public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) { if (event.getOperation().isLocal()) { throw new UnsupportedOperationInTransactionException(); } Object result = proxy.destroy(event.getKey(), expectedOldValue, event.getOperation(), event, event.getCallbackArgument()); if (result instanceof EntryNotFoundException) { throw (EntryNotFoundException) result; } }
@Override public boolean invalidate(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry, boolean forceCallbacks) throws EntryNotFoundException { if (event.getOperation().isLocal()) { if (this.owner.isInitialized()) { AbstractRegionMap.forceInvalidateEvent(event, this.owner); } throw new EntryNotFoundException(event.getKey().toString()); } this.owner.serverInvalidate(event); this.owner.recordEvent(event); this.owner.basicInvalidatePart2(markerEntry, event, false /* Clear conflict occurred */, true); this.owner.basicInvalidatePart3(markerEntry, event, true); return true; }
public static void logInvalidate(EntryEventImpl event) { if (isEnabled()) { final String invalidationType = event.getOperation().isLocal() ? "local_invalid" : "invalid"; GRAPH_LOGGER.logTransition(GraphType.KEY, getGraphName(event), getEdgeName("invalidate"), invalidationType, getSource(), getDest()); } }
/** * Check if this event can be distributed by senders. * * @return boolean True if the event is allowed. */ private boolean checkForDistribution(EntryEventImpl event, GatewaySenderStats stats) { if (event.getRegion().getDataPolicy().equals(DataPolicy.NORMAL)) { return false; } // Check for eviction and expiration events. if (event.getOperation().isLocal() || event.getOperation().isExpiration()) { // Check if its AEQ and is configured to forward expiration destroy events. if (event.getOperation().isExpiration() && this.isAsyncEventQueue() && this.isForwardExpirationDestroy()) { return true; } return false; } return true; }
protected boolean needWriteLock(EntryEventImpl event) { return !(event.isOriginRemote() || event.isNetSearch() || event.getOperation().isLocal() || event.getOperation().isPutAll() || event.getOperation().isRemoveAll() || (event.isExpiration() && isEntryEvictDestroyEnabled() || event.isPendingSecondaryExpireDestroy())); }
@Override public boolean requiresOneHopForMissingEntry(EntryEventImpl event) { // received from another member - don't use one-hop if (event.isOriginRemote()) { return false; } // local ops aren't distributed if (event.getOperation().isLocal()) { return false; } // if it already has a valid version tag it can go out with a DistributedCacheOperation if (event.getVersionTag() != null && event.getVersionTag().getRegionVersion() > 0) { return false; } // if we're not allowed to generate a version tag we need to send it to someone who can if (!this.generateVersionTag) { return true; } return this.getConcurrencyChecksEnabled() && (this.serverRegionProxy == null) && !isTX() && this.scope.isDistributed() && !this.getDataPolicy().withReplication(); }