Search in sources :

Example 1 with ServerLocator

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());
    }
}
Also used : ServerLocator(org.apache.geode.distributed.internal.ServerLocator)

Example 2 with ServerLocator

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()));
}
Also used : InternalLocator(org.apache.geode.distributed.internal.InternalLocator) InternalLogWriter(org.apache.geode.internal.logging.InternalLogWriter) List(java.util.List) LocalLogWriter(org.apache.geode.internal.logging.LocalLogWriter) ServerLocator(org.apache.geode.distributed.internal.ServerLocator)

Example 3 with ServerLocator

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);
        }
    }
}
Also used : InternalLocator(org.apache.geode.distributed.internal.InternalLocator) ArrayList(java.util.ArrayList) List(java.util.List) ServerLocator(org.apache.geode.distributed.internal.ServerLocator)

Example 4 with ServerLocator

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);
}
Also used : QueueConnectionRequest(org.apache.geode.cache.client.internal.locator.QueueConnectionRequest) InternalLocator(org.apache.geode.distributed.internal.InternalLocator) SerializableRunnable(org.apache.geode.test.dunit.SerializableRunnable) QueueConnectionResponse(org.apache.geode.cache.client.internal.locator.QueueConnectionResponse) ServerLocator(org.apache.geode.distributed.internal.ServerLocator) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

ServerLocator (org.apache.geode.distributed.internal.ServerLocator)4 InternalLocator (org.apache.geode.distributed.internal.InternalLocator)3 List (java.util.List)2 ArrayList (java.util.ArrayList)1 QueueConnectionRequest (org.apache.geode.cache.client.internal.locator.QueueConnectionRequest)1 QueueConnectionResponse (org.apache.geode.cache.client.internal.locator.QueueConnectionResponse)1 InternalLogWriter (org.apache.geode.internal.logging.InternalLogWriter)1 LocalLogWriter (org.apache.geode.internal.logging.LocalLogWriter)1 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)1 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)1 Test (org.junit.Test)1