/** * Creates a new <code>ReplyProcessor</code> that wants replies from some number of members of a * distributed system. Call this method with * {@link ClusterDistributionManager#getDistributionManagerIds} if you want replies from all DMs * including the one hosted in this VM. * * @param dm the DistributionManager to use for messaging and membership * @param initMembers the Set of members this processor wants replies from */ public ReplyProcessor21(DistributionManager dm, Collection initMembers) { this(dm, dm.getSystem(), initMembers, null); }
/** * Creates a new <code>ReplyProcessor</code> that wants replies from some number of members of a * distributed system. Call this method with * {@link ClusterDistributionManager#getDistributionManagerIds} if you want replies from all DMs * including the one hosted in this VM. * * @param dm the DistributionManager to use for messaging and membership * @param initMembers the Set of members this processor wants replies from */ public DirectReplyProcessor(DistributionManager dm, Collection initMembers) { this(dm, dm.getSystem(), initMembers, null); }
/** * returns the idle connection timer, or null if the connection table is closed. guarded by a sync * on the connection table */ protected synchronized SystemTimer getIdleConnTimer() { if (this.closed) { return null; } if (this.idleConnTimer == null) { this.idleConnTimer = new SystemTimer(getDM().getSystem(), true); } return this.idleConnTimer; }
private ConnectionTable(TCPConduit conduit) throws IOException { this.owner = conduit; this.idleConnTimer = (this.owner.idleConnectionTimeout != 0) ? new SystemTimer(conduit.getDM().getSystem(), true) : null; this.threadOrderedConnMap = new ThreadLocal(); this.threadConnMaps = new ArrayList(); this.threadConnectionMap = new ConcurrentHashMap(); this.p2pReaderThreadPool = createThreadPoolForIO(conduit.getDM().getSystem().isShareSockets()); this.socketCloser = new SocketCloser(); }
/** * Returns true if calling thread owns its own communication resources. */ boolean threadOwnsResources() { DistributionManager d = getDM(); if (d != null) { return d.getSystem().threadOwnsResources() && !AlertingAction.isThreadAlerting(); } return false; }
/** * Must return a proper response to this request. * */ @Override protected AdminResponse createResponse(DistributionManager dm) { return RegionAttributesResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem())); }
/** * Must return a proper response to this request. * */ @Override protected AdminResponse createResponse(DistributionManager dm) { return SubRegionResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem())); }
/** * Returns true if calling thread owns its own communication resources. */ boolean threadOwnsResources() { DistributionManager d = getDM(); if (d != null) { return d.getSystem().threadOwnsResources() && !AlertingAction.isThreadAlerting(); } return false; }
/** * Must return a proper response to this request. */ @Override protected AdminResponse createResponse(DistributionManager dm) { return RegionStatisticsResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem())); }
@Before public void setUp() throws Exception { dm = mock(DistributionManager.class); sender = mock(InternalDistributedMember.class); member = mock(InternalDistributedMember.class); cache = mock(InternalCache.class); recipients = new HashSet<>(); when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class)); when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); flushToDiskFactory = new FlushToDiskFactory(); }
private boolean hookupRegion(DistributionManager dm) { this.internalRegion = getRegionByPath(dm, regionPath); if (this.internalRegion == null && this.parentRegionPath != null) { this.internalRegion = getRegionByPath(dm, this.parentRegionPath); this.regionPath = this.parentRegionPath; } if (this.internalRegion == null && dm.getSystem().isLoner()) { // If there are additional regions that the server enlisted in the tx, // which the client does not have, the client can just ignore the region // see bug 51922 return false; } return true; }
@Before public void setUp() throws Exception { resultCollector = mock(BackupResultCollector.class); dm = mock(DistributionManager.class); sender = mock(InternalDistributedMember.class); member = mock(InternalDistributedMember.class); cache = mock(InternalCache.class); recipients = new HashSet<>(); when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class)); when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); finishBackupFactory = new FinishBackupFactory(); }
@Before public void setUp() throws Exception { resultCollector = mock(BackupResultCollector.class); dm = mock(DistributionManager.class); sender = mock(InternalDistributedMember.class); member = mock(InternalDistributedMember.class); cache = mock(InternalCache.class); recipients = new HashSet<>(); when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class)); when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); abortBackupFactory = new AbortBackupFactory(); }
@Before public void setUp() throws Exception { resultCollector = mock(BackupResultCollector.class); dm = mock(DistributionManager.class); sender = mock(InternalDistributedMember.class); member = mock(InternalDistributedMember.class); cache = mock(InternalCache.class); recipients = new HashSet<>(); when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class)); when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); prepareBackupFactory = new PrepareBackupFactory(); }
/** * wait for the current operations being sent on views prior to the joining of the given member * to be placed on communication channels before returning * * @since GemFire 5.1 */ void waitForCurrentOperations() { long timeout = 1000L * distributionAdvisor.getDistributionManager().getSystem().getConfig() .getAckWaitThreshold(); waitForCurrentOperations(logger, timeout, timeout * 2L); }
private InternalDistributedMember getElderId() { InternalDistributedMember elder = this.dm.getElderId(); if (elder == null) { this.dm.getSystem().getCancelCriterion().checkCancelInProgress(null); } Assert.assertTrue(elder != null); return elder; }
/** * Returns a <code>FetchSysCfgResponse</code> that will be returned to the specified recipient. * The message will contains a copy of the local manager's config. */ public static FetchSysCfgResponse create(DistributionManager dm, InternalDistributedMember recipient) { FetchSysCfgResponse m = new FetchSysCfgResponse(); m.setRecipient(recipient); Config conf = dm.getSystem().getConfig(); if (conf instanceof RuntimeDistributionConfigImpl) { m.sc = ((RuntimeDistributionConfigImpl) conf).takeSnapshot(); } return m; }
/** * Returns a <code>CancelStatListenerResponse</code> that will be returned to the specified * recipient. The message will contains a copy of the local manager's system config. */ public static CancelStatListenerResponse create(DistributionManager dm, InternalDistributedMember recipient, int listenerId) { CancelStatListenerResponse m = new CancelStatListenerResponse(); m.setRecipient(recipient); GemFireStatSampler sampler = null; sampler = dm.getSystem().getStatSampler(); if (sampler != null) { sampler.removeListener(listenerId); } return m; }
private DistributedLockService getLockService(DistributionManager dm) { DistributedLockService dls = DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME); if (dls == null) { synchronized (LOCK_SYNC) { dls = DistributedLockService.getServiceNamed(LOCK_SERVICE_NAME); if (dls == null) { // Create the DistributedLockService dls = DistributedLockService.create(LOCK_SERVICE_NAME, dm.getSystem()); } } } Assert.assertTrue(dls != null); return dls; } }
/** * Returns a <code>AddStatListenerResponse</code> that will be returned to the specified * recipient. The message will contains a copy of the local manager's system config. */ public static AddStatListenerResponse create(DistributionManager dm, InternalDistributedMember recipient, long resourceId, String statName) { AddStatListenerResponse m = new AddStatListenerResponse(); m.setRecipient(recipient); GemFireStatSampler sampler = null; sampler = dm.getSystem().getStatSampler(); if (sampler != null) { m.listenerId = sampler.addListener(recipient, resourceId, statName); } return m; }