@Override public Object setUserAttribute(Object value) { checkTX(); throwIfUAOperationForPR(); TXEntryUserAttrState tx = txWriteUA(this.keyInfo); if (tx != null) { return tx.setPendingValue(value); } else { checkEntryDestroyed(); if (this.localRegion.entryUserAttributes == null) { this.localRegion.entryUserAttributes = new Hashtable(); } return this.localRegion.entryUserAttributes.put(keyInfo, value); } }
/** * @since GemFire 5.0 */ @Override public Object setValue(Object arg0) { return this.localRegion.put(this.getKey(), arg0); }
@Override public Object getUserAttribute() { checkTX(); throwIfUAOperationForPR(); TXEntryUserAttrState tx = txReadUA(this.keyInfo); if (tx != null) { return tx.getPendingValue(); } else { checkEntryDestroyed(); return this.localRegion.basicGetEntryUserAttribute(this.keyInfo.getKey()); } }
@Override public CacheStatistics getStatistics() { checkEntryDestroyed(); checkTX(); if (!this.localRegion.statisticsEnabled) { throw new StatisticsDisabledException(
@Override @Unretained public Object getValue() { return getValue(true); }
@Override public Region getRegion() { checkEntryDestroyed(); return this.localRegion; }
@Override public Entry getEntry(final KeyInfo keyInfo, final LocalRegion region, boolean allowTombstones) { TXEntryState tx = txReadEntry(keyInfo, region, true, true/* create txEntry is absent */); if (tx != null && tx.existsLocally()) { return new TXEntry(region, keyInfo, getProxy()); } else { return null; } }
@Override public boolean isDestroyed() { if (this.entryIsDestroyed) { return true; } checkTX(); try { if (!this.myTX.containsKey(this.keyInfo, this.localRegion)) { this.entryIsDestroyed = true; } } catch (RegionDestroyedException ex) { this.entryIsDestroyed = true; } catch (CancelException ex) { this.entryIsDestroyed = true; } return this.entryIsDestroyed; }
private void checkEntryDestroyed() { if (isDestroyed()) { throw new EntryDestroyedException(this.keyInfo.getKey().toString()); } }
} else { if ((re instanceof TXEntry)) { result = ((TXEntry) re).getValue(allowTombstones); } else { result = re.getValue();
@Override public Object getKey() { checkEntryDestroyed(); return this.keyInfo.getKey(); }
@Override public Object getEntryForIterator(KeyInfo curr, LocalRegion currRgn, boolean rememberReads, boolean allowTombstones) { if (currRgn instanceof PartitionedRegion) { PartitionedRegion pr = (PartitionedRegion) currRgn; if (!pr.getBucketPrimary(curr.getBucketId()).equals(pr.cache.getMyId())) { // to fix bug 47893 suspend the tx before calling nonTXGetEntry final TXManagerImpl txmgr = pr.getGemFireCache().getTXMgr(); final TXStateProxy tx = txmgr.pauseTransaction(); try { return pr.nonTXGetEntry(curr, false, allowTombstones); } finally { txmgr.unpauseTransaction(tx); } } } TXEntryState txEntryState = readEntryAndCheckIfDestroyed(curr, currRgn, rememberReads, allowTombstones); if (txEntryState != null) { // need to create KeyInfo since higher level iterator may reuse KeyInfo return new TXEntry(currRgn, new KeyInfo(curr.getKey(), curr.getCallbackArg(), curr.getBucketId()), proxy, rememberReads); } return null; }
@Unretained public Object getValue(boolean createIfAbsent) { checkTX(); // Object value = this.localRegion.getDeserialized(this.key, false, this.myTX, // this.rememberReads); @Unretained Object value = this.myTX.getDeserializedValue(keyInfo, this.localRegion, false, false, false, null, false, false, createIfAbsent); if (value == null) { throw new EntryDestroyedException(this.keyInfo.getKey().toString()); } else if (Token.isInvalid(value)) { return null; } return value; }
@Override public int hashCode() { return this.keyInfo.getKey().hashCode() ^ this.getRegion().hashCode(); }