/** * Flavor of keys that will not do repeatable read * * @since GemFire 5.5 */ public Set testHookKeys() { checkReadiness(); checkForNoAccess(); return new EntriesSet(this, false, IteratorType.KEYS, false /* allowTombstones */); }
/** * return a set of the keys in this region * * @param allowTombstones whether destroyed entries should be included * @return the keys */ public Set keySet(boolean allowTombstones) { checkReadiness(); checkForNoAccess(); return new EntriesSet(this, false, IteratorType.KEYS, allowTombstones); }
@Override public boolean containsKeyOnServer(Object key) { checkReadiness(); checkForNoAccess(); ServerRegionProxy proxy = getServerProxy(); if (proxy != null) { return proxy.containsKey(key); } else { throw new UnsupportedOperationException( "Server keySet requires a pool."); } }
/** * Returns true if the value is present in the Map */ @Override public boolean containsValue(final Object value) { if (value == null) { throw new NullPointerException( "Value for containsValue(value) cannot be null"); } checkReadiness(); checkForNoAccess(); boolean result = false; for (Object entry : new EntriesSet(this, false, IteratorType.VALUES, false)) { if (entry != null) { if (value.equals(entry)) { result = true; break; } } } return result; }
@Override public Collection values() { checkReadiness(); checkForNoAccess(); if (!restoreSetOperationTransactionBehavior) { discoverJTA(); } return new EntriesSet(this, false, IteratorType.VALUES, false); }
@Override public Set entrySet(boolean recursive) { checkReadiness(); checkForNoAccess(); if (!restoreSetOperationTransactionBehavior) { discoverJTA(); } return basicEntries(recursive); }
public Set keys() { checkReadiness(); checkForNoAccess(); if (!restoreSetOperationTransactionBehavior) { discoverJTA(); } return new EntriesSet(this, false, IteratorType.KEYS, false); }
@Override public boolean containsKey(Object key) { checkReadiness(); checkForNoAccess(); return getDataView().containsKey(getKeyInfo(key), this); }
getDataPolicy())); checkForNoAccess(); DataOutputStream out = new DataOutputStream(outputStream); try {
@Override public Region.Entry getEntry(Object key) { validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); return getDataView().getEntry(getKeyInfo(key), this, false); }
@Override public void localInvalidateRegion(Object aCallbackArgument) { getDataView().checkSupportsRegionInvalidate(); checkReadiness(); checkForNoAccess(); RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_LOCAL_INVALIDATE, aCallbackArgument, false, getMyId()); basicInvalidateRegion(event); }
@Override public boolean containsTombstone(Object key) { checkReadiness(); checkForNoAccess(); if (!this.getConcurrencyChecksEnabled()) { return false; } else { try { Entry entry = getDataView().getEntry(getKeyInfo(key), this, true); return entry != null && entry.getValue() == Token.TOMBSTONE; } catch (EntryDestroyedException ignore) { return true; } } }
@Override public void localDestroy(Object key, Object aCallbackArgument) throws EntryNotFoundException { validateKey(key); checkReadiness(); checkForNoAccess(); @Released EntryEventImpl event = EntryEventImpl.create(this, Operation.LOCAL_DESTROY, key, null, aCallbackArgument, false, getMyId()); if (generateEventID()) { event.setNewEventId(this.cache.getDistributedSystem()); } try { basicDestroy(event, false, null); // expectedOldValue } catch (CacheWriterException e) { // cache writer not called throw new Error( "Cache Writer should not have been called for localDestroy", e); } catch (TimeoutException e) { // no distributed lock throw new Error( "No distributed lock should have been attempted for localDestroy", e); } finally { event.release(); } }
/** * (description copied from entryCount() Returns the number of entries in this region. Note that * because of the concurrency properties of the {@link RegionMap}, the number of entries is only * an approximate. That is, other threads may change the number of entries in this region while * this method is being invoked. * * @see LocalRegion#entryCount() */ @Override public int size() { checkReadiness(); checkForNoAccess(); discoverJTA(); boolean isClient = this.imageState.isClient(); if (isClient) { // bug #40871 - test sees wrong size for region during RI lockRIReadLock(); } try { return entryCount(); } finally { if (isClient) { unlockRIReadLock(); } } }
/** * Just like getEntry but also updates the stats that get would have depending on a flag. See bug * 42410. Also skips discovering JTA * * @return the entry if it exists; otherwise null. */ public Entry accessEntry(Object key, boolean updateStats) { validateKey(key); checkReadiness(); checkForNoAccess(); if (updateStats) { return getDataView().accessEntry(getKeyInfo(key), this); } else { return getDataView().getEntry(getKeyInfo(key), this, false); } }
/** * Clear the region from a server request. * * @param callbackArgument The callback argument. This is currently null since * {@link java.util.Map#clear} supports no parameters. * @param processedMarker Whether the marker has been processed (for durable clients) */ public void basicBridgeClientClear(Object callbackArgument, boolean processedMarker) { checkReadiness(); checkForNoAccess(); RegionEventImpl event = new RegionEventImpl(this, Operation.REGION_LOCAL_CLEAR, callbackArgument, true, getMyId(), generateEventID()/* generate EventID */); // If the marker has been processed, process this clear event normally; // otherwise, this event occurred in the past and has been stored for a // durable client. In this case, just invoke the clear callbacks. if (processedMarker) { basicLocalClear(event); } else { if (isInitialized()) { dispatchListenerEvent(EnumListenerEvent.AFTER_REGION_CLEAR, event); } } }
@Override public void localInvalidate(Object key, Object aCallbackArgument) throws EntryNotFoundException { validateKey(key); checkReadiness(); checkForNoAccess(); @Released EntryEventImpl event = EntryEventImpl.create(this, Operation.LOCAL_INVALIDATE, key, null/* newValue */, aCallbackArgument, false, getMyId()); try { if (generateEventID()) { event.setNewEventId(this.cache.getDistributedSystem()); } event.setLocalInvalid(true); basicInvalidate(event); } finally { event.release(); } }
protected boolean nonTXContainsValueForKey(KeyInfo keyInfo) { checkReadiness(); checkForNoAccess(); if (this.diskRegion != null) { this.diskRegion.setClearCountReference();
validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); CachePerfStats stats = getCachePerfStats();