use of org.apache.zookeeper.Watcher.Event.EventType in project zookeeper by apache.
the class WatcherFuncTest method setUp.
@BeforeEach
@Override
public void setUp() throws Exception {
super.setUp();
client_latch = new CountDownLatch(1);
client_dwatch = new SimpleWatcher(client_latch);
client = createClient(client_dwatch, client_latch);
lsnr_latch = new CountDownLatch(1);
lsnr_dwatch = new SimpleWatcher(lsnr_latch);
lsnr = createClient(lsnr_dwatch, lsnr_latch);
expected = new ArrayList<EventType>();
}
use of org.apache.zookeeper.Watcher.Event.EventType in project zookeeper by apache.
the class WatchedEventTest method testCreatingWatchedEventFromWrapper.
@Test
public void testCreatingWatchedEventFromWrapper() {
// Make sure we can handle any type of correct wrapper
EnumSet<EventType> allTypes = EnumSet.allOf(EventType.class);
EnumSet<KeeperState> allStates = EnumSet.allOf(KeeperState.class);
WatchedEvent we;
WatcherEvent wep;
for (EventType et : allTypes) {
for (KeeperState ks : allStates) {
wep = new WatcherEvent(et.getIntValue(), ks.getIntValue(), "blah");
we = new WatchedEvent(wep);
assertEquals(et, we.getType());
assertEquals(ks, we.getState());
assertEquals("blah", we.getPath());
}
}
}
use of org.apache.zookeeper.Watcher.Event.EventType in project coprhd-controller by CoprHD.
the class ZkCmdHandler method process.
/**
* Interface Method, do things after receiving event from Server Watcher
*/
@Override
public void process(WatchedEvent event) {
KeeperState eventState = event.getState();
EventType eventType = event.getType();
log.info("Receive from Watcher, State: {}, Type: {}.", eventState, eventType);
if (eventState == KeeperState.SyncConnected) {
connectedSignal.countDown();
log.info("Connect to {} sucessfully", connectionString);
}
}
Aggregations