use of org.apache.geode.distributed.internal.ServerLocator in project geode by apache.
the class ControllerAdvisor method profilesChanged.
@Override
protected void profilesChanged() {
if (pollIsInitialized()) {
super.profilesChanged();
ServerLocator sl = (ServerLocator) getAdvisee();
sl.setLocatorCount(getControllerCount());
sl.setServerCount(getBridgeServerCount());
}
}
use of org.apache.geode.distributed.internal.ServerLocator in project geode by apache.
the class LocatorLoadBalancingDUnitTest method checkLocatorLoad.
public void checkLocatorLoad(final Map expected) {
List locators = Locator.getLocators();
Assert.assertEquals(1, locators.size());
InternalLocator locator = (InternalLocator) locators.get(0);
final ServerLocator sl = locator.getServerLocatorAdvisee();
InternalLogWriter log = new LocalLogWriter(InternalLogWriter.FINEST_LEVEL, System.out);
sl.getDistributionAdvisor().dumpProfiles("PROFILES= ");
Awaitility.await().pollDelay(100, TimeUnit.MILLISECONDS).pollInterval(100, TimeUnit.MILLISECONDS).timeout(300, TimeUnit.SECONDS).until(() -> expected.equals(sl.getLoadMap()));
}
use of org.apache.geode.distributed.internal.ServerLocator in project geode by apache.
the class CacheServerLoadMessage method updateLocalLocators.
public void updateLocalLocators() {
List locators = Locator.getLocators();
for (int i = 0; i < locators.size(); i++) {
InternalLocator l = (InternalLocator) locators.get(i);
ServerLocator serverLocator = l.getServerLocatorAdvisee();
if (serverLocator != null) {
serverLocator.updateLoad(location, load, this.clientIds);
}
}
}
use of org.apache.geode.distributed.internal.ServerLocator in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method testGatewaySenderNotRegisteredAsCacheServer.
@Test
public void testGatewaySenderNotRegisteredAsCacheServer() {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCacheInVMs(nyPort, vm2, vm3);
createReceiverInVMs(vm2, vm3);
createCacheInVMs(lnPort, vm4, vm5);
vm4.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 10, false, true, null, true));
vm5.invoke(() -> WANTestBase.createSender("ln", 2, false, 100, 10, false, true, null, true));
startSenderInVMs("ln", vm4, vm5);
SerializableRunnable check = new SerializableRunnable("assert no cache servers") {
public void run() {
InternalLocator inl = (InternalLocator) Locator.getLocator();
ServerLocator server = inl.getServerLocatorAdvisee();
LogWriterUtils.getLogWriter().info("Server load map is " + server.getLoadMap());
assertTrue("expected an empty map but found " + server.getLoadMap(), server.getLoadMap().isEmpty());
QueueConnectionRequest request = new QueueConnectionRequest(ClientProxyMembershipID.getNewProxyMembership(InternalDistributedSystem.getConnectedInstance()), 1, new HashSet<>(), "", false);
QueueConnectionResponse response = (QueueConnectionResponse) server.processRequest(request);
assertTrue("expected no servers but found " + response.getServers(), response.getServers().isEmpty());
}
};
vm0.invoke(check);
vm1.invoke(check);
}
Aggregations