/** return null if not found */ @Override public final RegionEntry basicGetEntry(Object key) { // ok to ignore tx state; all callers are non-transactional final RegionEntry re = this.entries.getEntry(key); if (re != null && !re.isRemoved()) { return re; } return null; }
/** * Checks if the entry is a valid entry * * @return true if entry not null or entry is not removed * */ protected boolean checkEntryNotValid(RegionEntry mapEntry) { return (mapEntry == null || (mapEntry.isRemoved() && !mapEntry.isTombstone())); }
/** * Checks if the entry is a valid entry * * @return true if entry not null or entry is not removed * */ protected boolean checkEntryNotValid(RegionEntry mapEntry) { return (mapEntry == null || (mapEntry.isRemoved() && !mapEntry.isTombstone())); }
/** return null if not found */ @Override public RegionEntry basicGetEntry(Object key) { // ok to ignore tx state; all callers are non-transactional RegionEntry re = this.entries.getEntry(key); if (re != null && re.isRemoved()) { re = null; } return re; }
public final boolean containsKey(Object key) { RegionEntry re = getEntry(key); if (re == null) { return false; } if (re.isRemoved()) { return false; } return true; }
public final boolean containsKey(Object key) { RegionEntry re = getEntry(key); if (re == null) { return false; } if (re.isRemoved()) { return false; } return true; }
public DiskEntry getDiskEntry(Object key) { // should return tombstone as an valid entry RegionEntry re = this.entries.getEntry(key); if (re != null && re.isRemoved() && !re.isTombstone()) { re = null; } return (DiskEntry)re; }
public DiskEntry getDiskEntry(Object key) { // should return tombstone as an valid entry RegionEntry re = this.entries.getEntry(key); if (re != null && re.isRemoved() && !re.isTombstone()) { re = null; } return (DiskEntry)re; }
private boolean firstEntry(RegionEntry re) { return (re.getVersionStamp().getEntryVersion() == 0) && re.isRemoved(); }
public DiskEntry getDiskEntry(Object key) { RegionEntry re = getRecoveredEntryMap().getEntry(key); if (re != null && re.isRemoved() && !re.isTombstone()) { re = null; } return (DiskEntry)re; } public DiskEntry initializeRecoveredEntry(Object key, DiskEntry.RecoveredEntry value) {
private void checkEntryDestroyed() { this.region.getCancelCriterion().checkCancelInProgress(null); if (this.regionEntry.isRemoved()) { throw new EntryDestroyedException(this.regionEntry.getKey().toString()); } } }
public DiskEntry getDiskEntry(Object key) { RegionEntry re = getRecoveredEntryMap().getEntry(key); if (re != null && re.isRemoved() && !re.isTombstone()) { re = null; } return (DiskEntry)re; } public DiskEntry initializeRecoveredEntry(Object key, DiskEntry.RecoveredEntry value) {
private void checkEntryDestroyed() { this.region.getCancelCriterion().checkCancelInProgress(null); if (this.regionEntry.isRemoved()) { throw new EntryDestroyedException(this.regionEntry.getKeyCopy() .toString()); } } }
public final void writeSyncIfPresent(Object key, Runnable runner) { RegionEntry re = getEntry(key); if (re != null) { final boolean disabled = disableLruUpdateCallback(); try { synchronized (re) { if (!re.isRemoved()) { runner.run(); } } } finally { if (disabled) { enableLruUpdateCallback(); } try { lruUpdateCallback(); }catch(DiskAccessException dae) { this._getOwner().handleDiskAccessException(dae, true/* stop bridge servers*/); throw dae; } } } }
public final void writeSyncIfPresent(Object key, Runnable runner) { RegionEntry re = getEntry(key); if (re != null) { final boolean disabled = disableLruUpdateCallback(); try { synchronized (re) { if (!re.isRemoved()) { runner.run(); } } } finally { if (disabled) { enableLruUpdateCallback(); } try { lruUpdateCallback(); }catch(DiskAccessException dae) { this._getOwner().handleDiskAccessException(dae); throw dae; } } } }
/** * Create one of these in the local case so that we have a snapshot of the state * and can allow the bucket to move out from under us. */ public NonLocalRegionEntry(RegionEntry re, LocalRegion br, boolean allowTombstones) { this.key = re.getKey(); if (allowTombstones && re.isTombstone()) { // client get() operations need to see tombstone values this.value = Token.TOMBSTONE; } else { this.value = re.getValue(br); // OFFHEAP: copy into heap cd } Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); this.lastModified = re.getLastModified(); this.isRemoved = re.isRemoved(); VersionStamp stamp = re.getVersionStamp(); if (stamp != null) { this.versionTag = stamp.asVersionTag(); } }
/** * Create one of these in the local case so that we have a snapshot of the * state and can allow the bucket to move out from under us. */ protected NonLocalRegionEntry(RegionEntry re, LocalRegion br, boolean allowTombstones) { this.key = re.getKeyCopy(); // client get() operations need to see tombstone values if (allowTombstones && re.isTombstone()) { this.value = Token.TOMBSTONE; } else { this.value = re.getValue(br); // OFFHEAP: copy into heap cd } Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); this.lastModified = re.getLastModified(); this.isRemoved = re.isRemoved(); VersionStamp<?> stamp = re.getVersionStamp(); if (stamp != null) { this.versionTag = stamp.asVersionTag(); } }
private boolean continueUpdate(RegionEntry re, EntryEventImpl event, boolean ifOld, boolean replaceOnClient) { if (ifOld) { // only update, so just do tombstone maintainence and exit if (re.isTombstone() && event.getVersionTag() != null) { // refresh the tombstone so it doesn't time out too soon processVersionTag(re, event); try { re.setValue(_getOwner(), Token.TOMBSTONE); } catch (RegionClearedException e) { // that's okay - when writing a tombstone into a disk, the // region has been cleared (including this tombstone) } _getOwner().rescheduleTombstone(re, re.getVersionStamp().asVersionTag()); return false; } if (re.isRemoved() && !replaceOnClient) { return false; } } return true; }
private boolean continueUpdate(RegionEntry re, EntryEventImpl event, boolean ifOld, boolean replaceOnClient) { if (ifOld) { // only update, so just do tombstone maintainence and exit if (re.isTombstone() && event.getVersionTag() != null) { // refresh the tombstone so it doesn't time out too soon processVersionTag(re, event); try { re.setValue(_getOwner(), Token.TOMBSTONE); } catch (RegionClearedException e) { // that's okay - when writing a tombstone into a disk, the // region has been cleared (including this tombstone) } _getOwner().rescheduleTombstone(re, re.getVersionStamp().asVersionTag()); return false; } if (re.isRemoved() && !replaceOnClient) { return false; } } return true; }
@Override protected RegionEntry basicGetTXEntry(KeyInfo keyInfo) { int bucketId = keyInfo.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, null, keyInfo.getKey(), keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId); } if (keyInfo.isCheckPrimary()) { DistributedMember primary = getRegionAdvisor().getPrimaryMemberForBucket( bucketId); if (!primary.equals(getMyId())) { throw new PrimaryBucketException("Bucket " + bucketId + " is not primary. Current primary holder is " + primary); } } BucketRegion br = this.dataStore.getLocalBucketById(bucketId); RegionEntry re = br.basicGetEntry(keyInfo.getKey()); if (re != null && re.isRemoved()) { re = null; } return re; }