/** * {@inheritDoc} */ @Override public DistributionAdvisor getDistributionAdvisor() { return this.pbr != null ? this.pbr.getDistributionAdvisor() : this.dr .getDistributionAdvisor(); }
@Override protected void removeSenderFromAdvisor(InternalDistributedMember sender, int serial, boolean regionDestroyed) { getDistributionAdvisor().removeIdWithSerial(sender, serial, regionDestroyed); }
/** * {@inheritDoc} */ @Override public DistributionAdvisor getDistributionAdvisor() { return this.pbr != null ? this.pbr.getDistributionAdvisor() : this.dr .getDistributionAdvisor(); }
/** * {@inheritDoc} */ @Override public DistributionAdvisor getDistributionAdvisor() { return this.pbr != null ? this.pbr.getDistributionAdvisor() : this.dr .getDistributionAdvisor(); }
@Override protected void removeSenderFromAdvisor(InternalDistributedMember sender, int serial, boolean regionDestroyed) { getDistributionAdvisor().removeIdWithSerial(sender, serial, regionDestroyed); }
protected void releaseViewVersions() { RuntimeException rte = null; for (Iterator it=viewVersions.entrySet().iterator(); it.hasNext(); ) { Map.Entry e = (Map.Entry)it.next(); DistributedRegion dr = (DistributedRegion)e.getKey(); Long viewVersion = (Long)e.getValue(); // need to continue the iteration if one of the regions is destroyed // since others may still be okay try { long newv = dr.getDistributionAdvisor().endOperation(viewVersion.longValue()); } catch (RuntimeException ex) { rte = ex; } } if (rte != null) { throw rte; } }
public void run2() throws CacheException { DistributedRegion rgn1 = (DistributedRegion)getRootRegion(); assertTrue(!rgn1.getDistributionAdvisor().adviseGeneric().contains(closedMemberId)); rgn1 = (DistributedRegion)rgn1.getSubregion(rgnName); assertTrue(!rgn1.getDistributionAdvisor().adviseGeneric().contains(closedMemberId)); } });
public void run2() throws CacheException { DistributedRegion rgn1 = (DistributedRegion)getRootRegion(); assertTrue(rgn1.getDistributionAdvisor().adviseGeneric().contains(myMemberId)); rgn1 = (DistributedRegion)rgn1.getSubregion(rgnName); assertTrue(rgn1.getDistributionAdvisor().adviseGeneric().contains(myMemberId)); } });
public void run() { assertFalse(OutOfOffHeapMemoryDUnitTest.cache.get().isClosed()); assertTrue(OutOfOffHeapMemoryDUnitTest.system.get().isConnected()); int countMembersPlusLocator = count+2; // add one for locator int countOtherMembers = count-1; // subtract one for self assertEquals(countMembersPlusLocator, ((InternalDistributedSystem)OutOfOffHeapMemoryDUnitTest. system.get()).getDistributionManager().getDistributionManagerIds().size()); assertEquals(countOtherMembers, ((DistributedRegion)OutOfOffHeapMemoryDUnitTest. cache.get().getRegion(name)).getDistributionAdvisor().getNumProfiles()); } });
@SuppressWarnings({ "unchecked", "rawtypes" }) public Set<DistributedMember> getMembers(Region r) { if (r instanceof DistributedRegion) { DistributedRegion d = (DistributedRegion) r; return (Set)d.getDistributionAdvisor().adviseCacheOp(); } else if (r instanceof PartitionedRegion) { PartitionedRegion p = (PartitionedRegion) r; return p.getRegionAdvisor().adviseAllPRNodes(); } else { return Collections.emptySet(); } }
public Set<DistributedMember> getMembers(Region r) { if (r instanceof DistributedRegion) { DistributedRegion d = (DistributedRegion) r; return d.getDistributionAdvisor().adviseCacheOp(); } else if (r instanceof PartitionedRegion) { PartitionedRegion p = (PartitionedRegion) r; return p.getRegionAdvisor().adviseAllPRNodes(); } else { return Collections.EMPTY_SET; } }
public void run2() throws CacheException { Region rgn1 = getRootRegion().getSubregion(rgnName); assertEquals(numVMsMinusOne, ((DistributedRegion)rgn1).getDistributionAdvisor().adviseGeneric().size()); AttributesMutator mut = rgn1.getAttributesMutator(); mut.setCacheLoader(new CacheLoader() { public Object load(LoaderHelper helper) throws CacheLoaderException { return null; } public void close() { } }); } });
public void run() { final long TIME_LIMIT = 30 * 1000; final StopWatch stopWatch = new StopWatch(true); int i = 0; int countOtherMembers = count-1; Region<Object, Object> region = OutOfOffHeapMemoryDUnitTest.cache.get().getRegion(name); for (i = 0; countOtherMembers > count-2; i++) { region.put("key-"+i, new byte[1024]); countOtherMembers = ((DistributedRegion)OutOfOffHeapMemoryDUnitTest. cache.get().getRegion(name)).getDistributionAdvisor().getNumProfiles(); assertTrue("puts failed to push member out of off-heap memory within time limit", stopWatch.elapsedTimeMillis() < TIME_LIMIT); } assertEquals("Member did not depart from OutOfOffHeapMemory", count-2, countOtherMembers); } });
public static void FIX_PREVIOUS_OPS_COUNT(String tableName) throws SQLException { Region region = Misc.getRegionForTable(tableName, true); if (region != null) { if (region instanceof PartitionedRegion) { PartitionedRegion pr = (PartitionedRegion)region; for (BucketRegion br : pr.getDataStore().getAllLocalBucketRegions()) { br.getBucketAdvisor().resetPrevOpCount(); } } else if (region instanceof DistributedRegion) { ((DistributedRegion)region).getDistributionAdvisor().resetPrevOpCount(); } } } /**
public void testGenericAdvice() throws Exception { final RegionAttributes attrs = new AttributesFactory().create(); assertTrue(attrs.getScope().isDistributedNoAck()); assertTrue(attrs.getScope().isDistributed()); final String rgnName = getUniqueName(); for (int i = 0; i < vms.length; i++) { vms[i].invoke(new CacheSerializableRunnable("CacheAdvisorTest.testGenericAdvice;createRegion") { public void run2() throws CacheException { createRegion(rgnName, attrs); } }); } Set expected = new HashSet(Arrays.asList(ids)); DistributedRegion rgn = (DistributedRegion)createRegion(rgnName, attrs); // root region DistributedRegion rootRgn = (DistributedRegion)getRootRegion(); Set actual = rootRgn.getDistributionAdvisor().adviseGeneric(); assertEquals("Unexpected advice for root region=" + rootRgn, expected, actual); // subregion actual = rgn.getDistributionAdvisor().adviseGeneric(); assertEquals("Unexpected advice for subregion=" + rgn, expected, actual); }
public static VersionTag findVersionTag(LocalRegion r, EventID eventId, boolean isPutAll) { DM dm = r.getDistributionManager(); Set recipients; if (r instanceof DistributedRegion) { recipients = ((DistributedRegion)r).getDistributionAdvisor().adviseCacheOp(); } else { recipients = ((PartitionedRegion)r).getRegionAdvisor().adviseDataStore(); } ResultReplyProcessor processor = new ResultReplyProcessor(dm, recipients); FindVersionTagMessage msg = new FindVersionTagMessage(recipients, processor.getProcessorId(), r.getFullPath(), eventId, isPutAll); dm.putOutgoing(msg); try { processor.waitForReplies(); } catch (InterruptedException e) { dm.getCancelCriterion().checkCancelInProgress(e); Thread.currentThread().interrupt(); return null; } return processor.getVersionTag(); }
public static VersionTag findVersionTag(LocalRegion r, EventID eventId, boolean isBulkOp) { DM dm = r.getDistributionManager(); Set recipients; if (r instanceof DistributedRegion) { recipients = ((DistributedRegion)r).getDistributionAdvisor().adviseCacheOp(); } else { recipients = ((PartitionedRegion)r).getRegionAdvisor().adviseDataStore(); } ResultReplyProcessor processor = new ResultReplyProcessor(dm, recipients); FindVersionTagMessage msg = new FindVersionTagMessage(recipients, processor.getProcessorId(), r.getFullPath(), eventId, isBulkOp); dm.putOutgoing(msg); try { processor.waitForReplies(); } catch (InterruptedException e) { dm.getCancelCriterion().checkCancelInProgress(e); Thread.currentThread().interrupt(); return null; } return processor.getVersionTag(); }
/** pause local operations so that a clear() can be performed and flush comm channels to the given member */ public void lockLocallyForClear(DM dm, InternalDistributedMember locker) { RegionVersionVector rvv = getVersionVector(); if (rvv != null) { // block new operations from being applied to the region map rvv.lockForClear(getFullPath(), dm, locker); //Check for region destroyed after we have locked, to make sure //we don't continue a clear if the region has been destroyed. checkReadiness(); // wait for current operations to if (!locker.equals(dm.getDistributionManagerId())) { Set<InternalDistributedMember> mbrs = getDistributionAdvisor().adviseCacheOp(); StateFlushOperation.flushTo(mbrs, this); } } }
/** pause local operations so that a clear() can be performed and flush comm channels to the given member */ public void lockLocallyForClear(DM dm, InternalDistributedMember locker) { RegionVersionVector rvv = getVersionVector(); if (rvv != null) { // block new operations from being applied to the region map rvv.lockForClear(getFullPath(), dm, locker); //Check for region destroyed after we have locked, to make sure //we don't continue a clear if the region has been destroyed. checkReadiness(); // wait for current operations to if (!locker.equals(dm.getDistributionManagerId())) { Set<InternalDistributedMember> mbrs = getDistributionAdvisor().adviseCacheOp(); StateFlushOperation.flushTo(mbrs, this); } } }
/** * Returns true if there are no data stores available for this region. */ public boolean hasDataStores() { boolean hasStore = true; if (getScope() != Scope.LOCAL) { if (!getDataPolicy().withStorage()) { hasStore = !((DistributedRegion)this).getDistributionAdvisor() .accept(initDataStoreChecker, null); } } else { hasStore = getDataPolicy().withStorage(); } if (!hasStore) { // check if VM is going down before throwing no data store found getCancelCriterion().checkCancelInProgress(null); } final LogWriterI18n logger = getLogWriterI18n(); if (logger.fineEnabled()) { logger.fine("hasStore=" + hasStore + " for " + getFullPath()); } return hasStore; }