Search in sources :

Example 11 with ClientServerObserverAdapter

use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.

the class RedundancyLevelTestBase method createClientCache.

public static void createClientCache(String host, int port1, int port2, int port3, int port4, int redundancy, int socketReadTimeout, int retryInterval) throws Exception {
    if (!FailOverDetectionByCCU) {
        oldBo = ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

            public void beforeFailoverByCacheClientUpdater(ServerLocation epFailed) {
                try {
                    Thread.sleep(300000);
                } catch (InterruptedException ie) {
                    // expected - test will shut down the cache which will interrupt
                    // the CacheClientUpdater thread that invoked this method
                    Thread.currentThread().interrupt();
                }
            }
        });
    }
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    new RedundancyLevelTestBase().createCache(props);
    PoolImpl p = (PoolImpl) PoolManager.createFactory().addServer(host, PORT1).addServer(host, PORT2).addServer(host, PORT3).addServer(host, PORT4).setSubscriptionEnabled(true).setReadTimeout(socketReadTimeout).setSocketBufferSize(32768).setMinConnections(8).setSubscriptionRedundancy(redundancy).setRetryAttempts(5).setPingInterval(retryInterval).create("DurableClientReconnectDUnitTestPool");
    AttributesFactory factory = new AttributesFactory();
    factory.setScope(Scope.DISTRIBUTED_ACK);
    factory.setPoolName(p.getName());
    RegionAttributes attrs = factory.createRegionAttributes();
    cache.createRegion(REGION_NAME, attrs);
    pool = p;
    createEntriesK1andK2();
    registerK1AndK2();
}
Also used : AttributesFactory(org.apache.geode.cache.AttributesFactory) ServerLocation(org.apache.geode.distributed.internal.ServerLocation) RegionAttributes(org.apache.geode.cache.RegionAttributes) ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) PoolImpl(org.apache.geode.cache.client.internal.PoolImpl)

Example 12 with ClientServerObserverAdapter

use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.

the class Bug36457DUnitTest method setClientServerObserver.

public static void setClientServerObserver() {
    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;
    ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

        public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint) {
            LogWriterUtils.getLogWriter().fine("TEST FAILED HERE YOGI ");
            isFaileoverHappened = true;
        }
    });
}
Also used : ServerLocation(org.apache.geode.distributed.internal.ServerLocation) ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter)

Example 13 with ClientServerObserverAdapter

use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.

the class ClientConflationDUnitTest method setClientServerObserverForBeforeInterestRecovery.

/**
   * reset all counters to zero before interest recovery
   *
   */
public static void setClientServerObserverForBeforeInterestRecovery() {
    PoolImpl.BEFORE_RECOVER_INTEREST_CALLBACK_FLAG = true;
    ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

        public void beforeInterestRecovery() {
            setAllCountersZero();
        }
    });
}
Also used : ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter)

Example 14 with ClientServerObserverAdapter

use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.

the class DSObjectLocalOnly method setClientServerObserver1.

public static void setClientServerObserver1() {
    PoolImpl.IS_INSTANTIATOR_CALLBACK = true;
    ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

        @Override
        public void beforeSendingToServer(EventID eventID) {
            eventId = eventID;
            client2.invoke(() -> DataSerializerPropogationDUnitTest.setEventId(eventID));
        }
    });
}
Also used : EventID(org.apache.geode.internal.cache.EventID) ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter)

Example 15 with ClientServerObserverAdapter

use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.

the class DSObjectLocalOnly method setClientServerObserver2.

public static void setClientServerObserver2() {
    PoolImpl.IS_INSTANTIATOR_CALLBACK = true;
    ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {

        @Override
        public void afterReceivingFromServer(EventID eventID) {
            testEventIDResult = eventID.equals(eventId);
        }
    });
}
Also used : EventID(org.apache.geode.internal.cache.EventID) ClientServerObserverAdapter(org.apache.geode.internal.cache.ClientServerObserverAdapter)

Aggregations

ClientServerObserverAdapter (org.apache.geode.internal.cache.ClientServerObserverAdapter)22 ServerLocation (org.apache.geode.distributed.internal.ServerLocation)5 EventID (org.apache.geode.internal.cache.EventID)4 Region (org.apache.geode.cache.Region)2 ClientServerObserver (org.apache.geode.internal.cache.ClientServerObserver)2 ClientSubscriptionTest (org.apache.geode.test.junit.categories.ClientSubscriptionTest)2 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 Properties (java.util.Properties)1 AttributesFactory (org.apache.geode.cache.AttributesFactory)1 RegionAttributes (org.apache.geode.cache.RegionAttributes)1 PoolImpl (org.apache.geode.cache.client.internal.PoolImpl)1 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)1 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)1 LocalRegion (org.apache.geode.internal.cache.LocalRegion)1 IgnoredException (org.apache.geode.test.dunit.IgnoredException)1