@Override public boolean txLRUStart() { return this.entries.disableLruUpdateCallback(); }
@Override public void txLRUEnd() { this.entries.enableLruUpdateCallback(); try { this.entries.lruUpdateCallback(); } catch (DiskAccessException dae) { handleDiskAccessException(dae); throw dae; } }
protected void enableConcurrencyChecks() { this.setConcurrencyChecksEnabled(true); if (this.getDataPolicy().withStorage()) { RegionEntryFactory versionedEntryFactory = this.entries.getEntryFactory().makeVersioned(); Assert.assertTrue(this.entries.isEmpty(), "RegionMap should be empty but was of size:" + this.entries.size()); this.entries.setEntryFactory(versionedEntryFactory); } }
private void updateEventWithCurrentRegionEntry(EntryEventImpl event, EntryEventImpl clientEvent) { // defer the lruUpdateCallback to prevent a deadlock (see bug 51121). final boolean disabled = this.entries.disableLruUpdateCallback(); try { RegionEntry re = getRegionEntry(event.getKey()); if (re != null) { synchronized (re) { // bug #51059 value & version must be obtained atomically // Update client event with latest version tag from re if (clientEvent != null) { clientEvent.setVersionTag(re.getVersionStamp().asVersionTag()); } // OFFHEAP: need to incrc, copy to heap to setNewValue, decrc event.setNewValue(re.getValue(this)); } } } finally { if (disabled) { this.entries.enableLruUpdateCallback(); } try { this.entries.lruUpdateCallback(); } catch (DiskAccessException dae) { this.handleDiskAccessException(dae); throw dae; } } }
public GatewaySenderEventImpl addEvent(Object key) { this.bucketRegionQueue.getEventTracker().setInitialized(); this.bucketRegionQueue.entries.disableLruUpdateCallback(); GatewaySenderEventImpl event = mock(GatewaySenderEventImpl.class); this.bucketRegionQueue.entries.initialImagePut(key, 0, event, false, false, null, null, false); this.bucketRegionQueue.entries.enableLruUpdateCallback(); return event; }
regionEntry = this.entries.getEntry(keyInfo.getKey()); if (clientEvent != null && regionEntry.getVersionStamp() != null) { final boolean disabled = this.entries.disableLruUpdateCallback(); try { synchronized (regionEntry) { // bug #51059 value & version must be obtained atomically this.entries.enableLruUpdateCallback(); this.entries.lruUpdateCallback(); } catch (DiskAccessException dae) { this.handleDiskAccessException(dae);
this.entries.initialImagePut(currentKey, 0, Token.LOCAL_INVALID, false, false, null, null, false); this.entries.initialImagePut(currentKey, 0, val, false, false, tag, null, false); RegionEntry regionEntry = this.entries.getEntry(currentKey); if (!isProxy() && isKeyOnServer) { this.entries.initialImagePut(currentKey, 0, Token.LOCAL_INVALID, false, false, tag, null, false); } else { synchronized (regionEntry) { if (regionEntry.isDestroyedOrRemovedButNotTombstone()) { this.entries.removeEntry(currentKey, regionEntry, false);
RegionEntry regionEntry = this.entries.getEntry(entry.key); if (isTraceEnabled) { logger.trace("processChunk:entry={},tag={},re={}", entry, tag, regionEntry); this.entries.initialImagePut(entry.key, lastModified, tmpValue, wasRecovered, true, tag, sender, this.isSynchronizing); if (this.isSynchronizing) { this.entries.lruUpdateCallback(); this.region.getVersionVector().recordVersion(tag.getMemberID(), tag); this.entries.initialImagePut(entry.key, lastModified, tmpValue, wasRecovered, false, tag, sender, this.isSynchronizing); if (this.isSynchronizing) {
@Test public void cleanUpAfterFailedInitialImageHoldsLockForClear() { DistributedRegion distributedRegion = mock(DistributedRegion.class, RETURNS_DEEP_STUBS); RegionMap regionMap = mock(RegionMap.class); doCallRealMethod().when(distributedRegion).cleanUpAfterFailedGII(false); when(distributedRegion.getRegionMap()).thenReturn(regionMap); when(regionMap.isEmpty()).thenReturn(false); distributedRegion.cleanUpAfterFailedGII(false); verify(distributedRegion).lockFailedInitialImageWriteLock(); verify(distributedRegion).closeEntries(); verify(distributedRegion).unlockFailedInitialImageWriteLock(); }
tag = VersionTag.create(getVersionMember()); map.initialImagePut(key, cacheTimeMillis(), value, false, false, tag, null, false);
this.value = v; if (regionMap != null) { callFinish = regionMap.beginChangeValueForm(le, this, v); regionMap.finishChangeValueForm();
@Override public void closeEntries() { this.entries.close(this); }
/** * Allows null as new value to accommodate create with a null value. * * @param event the event object for this operation, with the exception that the oldValue * parameter is not yet filled in. The oldValue will be filled in by this operation. * @param lastModified the lastModified time to set with the value; if 0L then the lastModified * time will be set to now. * @return null if put not done; otherwise the put entry */ protected RegionEntry basicPutEntry(final EntryEventImpl event, final long lastModified) throws TimeoutException, CacheWriterException { discoverJTA(); TXStateInterface tx = getTXState(); // Note we are doing a load or netsearch result so it seems like we should set ifNew to true. // The entry should not yet exist. However since the non-tx code sets ifNew to false this code // will also. final boolean ifNew = false; if (isTX()) { tx.txPutEntry(event, ifNew, false, false, null); return null; } else { if (DistTXState.internalBeforeNonTXBasicPut != null) { DistTXState.internalBeforeNonTXBasicPut.run(); } return getRegionMap().basicPut(event, lastModified, ifNew, false, null, false, false); } }
@Override public Set<VersionSource> clearEntries(RegionVersionVector rvv) { return this.entries.clear(rvv, this); }
LocalRegion region = iterator.next(); try { long bytesEvicted = region.getRegionMap().centralizedLruUpdateCallback(); if (bytesEvicted == 0) { iterator.remove();
@Override public void copyExistingRegionMap(LocalRegion lr) { waitForRecoveryCompletion(); if (this.entriesMapIncompatible) { // Reset the numEntriesInVM. It will be incremented when the copy to the new map is done, // down in DiskEntry.Help.initialize. However, the other stats can't be updated // there because we don't have the value length at that point. So leave // those stats alone. this.numEntriesInVM.set(0); lr.initializeStats(this.getNumEntriesInVM(), this.getNumOverflowOnDisk(), this.getNumOverflowBytesOnDisk()); lr.copyRecoveredEntries(this.entries); } else { this.entries.changeOwner(lr); lr.initializeStats(this.getNumEntriesInVM(), this.getNumOverflowOnDisk(), this.getNumOverflowBytesOnDisk()); lr.copyRecoveredEntries(null); } this.entries = null; }
boolean preferCachedDeserializable, boolean retainResult) { assert !retainResult || preferCachedDeserializable; boolean disabledLRUCallback = this.entries.disableLruUpdateCallback(); try { @Retained } finally { if (disabledLRUCallback) { this.entries.enableLruUpdateCallback(); this.entries.lruUpdateCallback();
if (!getRegionMap().isEmpty()) { lockFailedInitialImageWriteLock(); try {
public void closeEntries() { this.entries.close(null); }
oldEntry = this.entries.basicPut(event, lastModified, ifNew, ifOld, expectedOldValue, requireOldValue, overwriteDestroyed); } catch (ConcurrentCacheModificationException ignore) {