use of org.apache.pulsar.zookeeper.ZooKeeperDataCache in project incubator-pulsar by apache.
the class LoadBalancerTest method testStop.
/**
* Ensure that the load manager's zookeeper data cache is shutdown after invoking stop().
*/
@Test
public void testStop() throws Exception {
final SimpleLoadManagerImpl loadManager = (SimpleLoadManagerImpl) pulsarServices[0].getLoadManager().get();
loadManager.stop();
Field loadReportCacheField = SimpleLoadManagerImpl.class.getDeclaredField("loadReportCacheZk");
loadReportCacheField.setAccessible(true);
ZooKeeperDataCache<LoadReport> loadReportCache = (ZooKeeperDataCache<LoadReport>) loadReportCacheField.get(loadManager);
Field IS_SHUTDOWN_UPDATER = ZooKeeperDataCache.class.getDeclaredField("IS_SHUTDOWN_UPDATER");
IS_SHUTDOWN_UPDATER.setAccessible(true);
final int TRUE = 1;
assert (((AtomicIntegerFieldUpdater<ZooKeeperDataCache>) (IS_SHUTDOWN_UPDATER.get(loadReportCache))).get(loadReportCache) == TRUE);
}
Aggregations