/** * Returns whether this event is on the PDX type region. * * @return whether this event is on the PDX type region */ public boolean isOnPdxTypeRegion() { return PeerTypeRegistration.REGION_FULL_PATH.equals(getRegion().getFullPath()); }
/** * Return true if this EntryEvent may have off-heap references. */ private boolean mayHaveOffHeapReferences() { InternalRegion lr = getRegion(); if (lr != null) { return lr.getOffHeap(); } // if region field is null it is possible that we have off-heap values return true; }
@Override public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) { return event.getRegion().virtualPut(event, ifNew, ifOld, expectedOldValue, requireOldValue, lastModified, overwriteDestroyed); }
private boolean shouldOldValueBeUnavailable(Object v, boolean force) { if (force) { return false; } if (areOldValuesEnabled()) { return false; } if (getRegion() instanceof HARegion) { return false; } return true; }
@Override public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) { PartitionedRegion pr = (PartitionedRegion) event.getRegion(); pr.destroyInBucket(event, expectedOldValue); }
@Override public void invalidateExistingEntry(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry) { try { event.getRegion().getRegionMap().invalidate(event, invokeCallbacks, forceNewEntry, false); } catch (ConcurrentCacheModificationException e) { // a newer event has already been applied to the cache. this can happen // in a client cache if another thread is operating on the same key } }
public DataPolicy getDataPolicy() { if (this.event != null) { return this.event.getRegion().getAttributes().getDataPolicy(); } return null; }
@Override public boolean putEntry(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) { return getTXRegionStub(event.getRegion()).putEntry(event, ifNew, ifOld, expectedOldValue, requireOldValue, lastModified, overwriteDestroyed); }
public void setSerializedNewValue(byte[] serializedValue) { Object newVal = null; if (serializedValue != null) { newVal = CachedDeserializableFactory.create(serializedValue, getRegion().getCache()); } basicSetNewValue(newVal, false); this.newValueBytes = serializedValue; this.cachedSerializedNewValue = serializedValue; }
@Override public void destroyOnRemote(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) throws DataLocationException { this.operationCount++; TXStateInterface tx = getRealDeal(event.getKeyInfo(), event.getRegion()); assert (tx instanceof TXState); tx.destroyOnRemote(event, cacheWrite, expectedOldValue); }
public void setSerializedOldValue(byte[] serializedOldValue) { final Object ov; if (serializedOldValue != null) { ov = CachedDeserializableFactory.create(serializedOldValue, getRegion().getCache()); } else { ov = null; } retainAndSetOldValue(ov); this.oldValueBytes = serializedOldValue; }
/** * Like getRawNewValue except that if the result is an off-heap reference then copy it to the * heap. Note: to prevent the heap copy use getRawNewValue instead */ public Object getRawNewValueAsHeapObject() { Object result = basicGetNewValue(); if (mayHaveOffHeapReferences()) { result = OffHeapHelper.copyIfNeeded(result, getRegion().getCache()); } return result; }
@Override public boolean putEntryOnRemote(EntryEventImpl event, boolean ifNew, boolean ifOld, Object expectedOldValue, boolean requireOldValue, long lastModified, boolean overwriteDestroyed) throws DataLocationException { PartitionedRegion pr = (PartitionedRegion) event.getRegion(); return pr.getDataStore().putLocally(event.getKeyInfo().getBucketId(), event, ifNew, ifOld, expectedOldValue, requireOldValue, lastModified); }
/** * throws an exception when cloning is disabled while using delta */ private void validateDelta(EntryEventImpl event) { if (event.getDeltaBytes() != null && !event.getRegion().getAttributes().getCloningEnabled()) { throw new UnsupportedOperationInTransactionException( "Delta without cloning cannot be used in transaction"); } }
@Test(expected = RegionDestroyedException.class) public void basicUpdateEntryVersionDoesNotReleaseLockIfKeysAndPrimaryNotLocked() { BucketRegion bucketRegion = spy(new BucketRegion(regionName, regionAttributes, partitionedRegion, cache, internalRegionArgs)); doThrow(regionDestroyedException).when(bucketRegion).lockKeysAndPrimary(event); when(event.getRegion()).thenReturn(bucketRegion); doReturn(true).when(bucketRegion).hasSeenEvent(event); doReturn(mock(AbstractRegionMap.class)).when(bucketRegion).getRegionMap(); bucketRegion.basicUpdateEntryVersion(event); verify(bucketRegion, never()).releaseLockForKeysAndPrimary(eq(event)); }
@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); }
private void updateEntry() throws RegionClearedException { final EntryEventImpl event = getEvent(); final RegionEntry re = getRegionEntry(); final boolean wasTombstone = re.isTombstone(); final int oldSize = event.getRegion().calculateRegionEntryValueSize(re); getRegionMap().processVersionTag(re, event); event.putExistingEntry(event.getRegion(), re, isRequireOldValue(), getOldValueForDelta()); EntryLogger.logPut(event); updateSize(oldSize, true/* isUpdate */, wasTombstone); }
@Override public void destroyExistingEntry(EntryEventImpl event, boolean cacheWrite, Object expectedOldValue) throws EntryNotFoundException { try { this.operationCount++; getRealDeal(event.getKeyInfo(), event.getRegion()).destroyExistingEntry(event, cacheWrite, expectedOldValue); trackBucketForTx(event.getKeyInfo()); } catch (TransactionDataRebalancedException | PrimaryBucketException re) { throw getTransactionException(event.getKeyInfo(), re); } }