@Override public Object next() { this.key.setKey(super.next()); this.key.setBucketId(this.currentBucketId); Object entry = view.getEntryForIterator(this.key, PartitionedRegion.this, true, allowTombstones); return entry != null ? entry : new DestroyedEntry(key.getKey().toString()); } }
@Override public boolean hasNext() { if (nextValue != null) { return true; } while (nextValue == null) { if (!super.hasNext()) { return false; } this.key.setKey(super.next()); this.key.setBucketId(this.currentBucketId); Region.Entry re = (Region.Entry) view.getEntryForIterator(key, PartitionedRegion.this, rememberReads, allowTombstones); if (re != null) { nextValue = re.getValue(); } } return true; }
@Override public DistributedMember getOwnerForKey(KeyInfo key) { if (key == null) { return super.getOwnerForKey(null); } // TODO provide appropriate Operation and arg int bucketId = key.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, null, key.getKey(), key.getValue(), key.getCallbackArg()); key.setBucketId(bucketId); } return createBucket(bucketId, 0, null); }
/** * @param access true if caller wants last accessed time updated * @param allowTombstones - whether a tombstone can be returned */ @Override protected Region.Entry<?, ?> nonTXGetEntry(KeyInfo keyInfo, boolean access, boolean allowTombstones) { final long startTime = PartitionedRegionStats.startTime(); final Object key = keyInfo.getKey(); try { int bucketId = keyInfo.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, Operation.GET_ENTRY, key, null, null); keyInfo.setBucketId(bucketId); } InternalDistributedMember targetNode = getOrCreateNodeForBucketRead(bucketId); return getEntryInBucket(targetNode, bucketId, key, access, allowTombstones); } finally { this.prStats.endGetEntry(startTime); } }
@Override protected boolean nonTXContainsValueForKey(KeyInfo keyInfo) { boolean containsValueForKey = false; int bucketId = keyInfo.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, Operation.CONTAINS_VALUE_FOR_KEY, keyInfo.getKey(), keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId); } InternalDistributedMember targetNode = getOrCreateNodeForBucketRead(bucketId); // targetNode null means that this key is not in the system. if (targetNode != null) { containsValueForKey = containsKeyInBucket(targetNode, bucketId, keyInfo.getKey(), true); } return containsValueForKey; }
bucketId = PartitionedRegionHelper.getHashKey(this, isCreate ? Operation.CREATE : null, key, null, aCallbackArgument); keyInfo.setBucketId(bucketId);
@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; }
@Override protected boolean nonTXContainsKey(KeyInfo keyInfo) { final long startTime = PartitionedRegionStats.startTime(); boolean contains = false; try { int bucketId = keyInfo.getBucketId(); if (bucketId == KeyInfo.UNKNOWN_BUCKET) { bucketId = PartitionedRegionHelper.getHashKey(this, Operation.CONTAINS_KEY, keyInfo.getKey(), keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId); } Integer bucketIdInt = bucketId; InternalDistributedMember targetNode = getOrCreateNodeForBucketRead(bucketId); // targetNode null means that this key is not in the system. if (targetNode != null) { contains = containsKeyInBucket(targetNode, bucketIdInt, keyInfo.getKey(), false); } } finally { this.prStats.endContainsKey(startTime); } return contains; }
bucketId = PartitionedRegionHelper.getHashKey(this, null, entryKey, keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId);
bucketId = PartitionedRegionHelper.getHashKey(this, null, entryKey, keyInfo.getValue(), keyInfo.getCallbackArg()); keyInfo.setBucketId(bucketId);