use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.
the class HAInterestTestCase method setClientServerObserverForBeforeRegistration.
public static void setClientServerObserverForBeforeRegistration(final VM vm) {
PoolImpl.BEFORE_REGISTER_CALLBACK_FLAG = true;
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void beforeInterestRegistration() {
synchronized (HAInterestTestCase.class) {
vm.invoke(() -> HAInterestTestCase.startServer());
HAInterestTestCase.isBeforeRegistrationCallbackCalled = true;
HAInterestTestCase.class.notify();
PoolImpl.BEFORE_REGISTER_CALLBACK_FLAG = false;
}
}
});
}
use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.
the class HAStartupAndFailoverDUnitTest method setClientServerObserver.
public static void setClientServerObserver() {
PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint) {
synchronized (HAStartupAndFailoverDUnitTest.class) {
HAStartupAndFailoverDUnitTest.identifiedPrimary = true;
HAStartupAndFailoverDUnitTest.class.notify();
}
}
});
}
use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.
the class HAInterestTestCase method setClientServerObserverForBeforeInterestRecovery.
public static void setClientServerObserverForBeforeInterestRecovery() {
PoolImpl.BEFORE_RECOVER_INTEREST_CALLBACK_FLAG = true;
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void beforeInterestRecovery() {
synchronized (HAInterestTestCase.class) {
Thread t = new Thread() {
public void run() {
Region r1 = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(r1);
r1.put(k1, server_k1_updated);
}
};
t.start();
HAInterestTestCase.isBeforeInterestRecoveryCallbackCalled = true;
HAInterestTestCase.class.notify();
PoolImpl.BEFORE_RECOVER_INTEREST_CALLBACK_FLAG = false;
}
}
});
}
use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.
the class HAInterestTestCase method setClientServerObserverForBeforeInterestRecoveryFailure.
public static void setClientServerObserverForBeforeInterestRecoveryFailure() {
PoolImpl.BEFORE_RECOVER_INTEREST_CALLBACK_FLAG = true;
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void beforeInterestRecovery() {
synchronized (HAInterestTestCase.class) {
Thread t = new Thread() {
public void run() {
getBackupVM().invoke(() -> HAInterestTestCase.startServer());
getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
}
};
t.start();
try {
ThreadUtils.join(t, 30 * 1000);
} catch (Exception ignore) {
exceptionOccurred = true;
}
HAInterestTestCase.isBeforeInterestRecoveryCallbackCalled = true;
HAInterestTestCase.class.notify();
PoolImpl.BEFORE_RECOVER_INTEREST_CALLBACK_FLAG = false;
}
}
});
}
use of org.apache.geode.internal.cache.ClientServerObserverAdapter in project geode by apache.
the class ConflationDUnitTest 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();
}
});
}
Aggregations