use of org.bboxdb.distribution.zookeeper.ZookeeperClient in project bboxdb by jnidzwetzki.
the class TestDistributedInstanceManager method getNewZookeeperClient.
/**
* Get a new instance of the zookeeper client
* @param instance
* @return
*/
private static ZookeeperClient getNewZookeeperClient(final BBoxDBInstance instance) {
final BBoxDBConfiguration scalephantConfiguration = BBoxDBConfigurationManager.getConfiguration();
final Collection<String> zookeepernodes = scalephantConfiguration.getZookeepernodes();
final ZookeeperClient zookeeperClient = new ZookeeperClient(zookeepernodes, CLUSTER_NAME);
zookeeperClient.init();
if (instance != null) {
final ZookeeperInstanceRegisterer registerer = new ZookeeperInstanceRegisterer(instance, zookeeperClient);
registerer.init();
}
return zookeeperClient;
}
use of org.bboxdb.distribution.zookeeper.ZookeeperClient in project bboxdb by jnidzwetzki.
the class DistributedRecoveryService method runRecoveryForDistributionGroup.
/**
* Run recovery for distribution group
* @param distributionGroupName
* @throws ZookeeperException
*/
protected void runRecoveryForDistributionGroup(final String distributionGroupName) {
try {
final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
final BBoxDBInstance localInstance = ZookeeperClientFactory.getLocalInstanceName();
for (final DiskStorage storage : storageRegistry.getAllStorages()) {
checkGroupVersion(storage, distributionGroupName, zookeeperClient);
}
final SpacePartitioner spacePartitioner = SpacePartitionerCache.getInstance().getSpacePartitionerForGroupName(distributionGroupName);
final DistributionRegion distributionGroup = spacePartitioner.getRootNode();
final List<OutdatedDistributionRegion> outdatedRegions = DistributionRegionHelper.getOutdatedRegions(distributionGroup, localInstance);
handleOutdatedRegions(distributionGroupName, outdatedRegions);
} catch (Throwable e) {
logger.error("Got exception while running recovery for distribution group: " + distributionGroupName, e);
}
}
use of org.bboxdb.distribution.zookeeper.ZookeeperClient in project bboxdb by jnidzwetzki.
the class StatisticsUpdateRunnable method updateNodeStats.
/**
* Update the local node stats (diskspace, memory)
* @throws ZookeeperException
*/
private void updateNodeStats() {
try {
final BBoxDBInstance instance = ZookeeperClientFactory.getLocalInstanceName();
logger.debug("Update zookeeper node stats");
final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
final ZookeeperBBoxDBInstanceAdapter zookeeperBBoxDBInstanceAdapter = new ZookeeperBBoxDBInstanceAdapter(zookeeperClient);
zookeeperBBoxDBInstanceAdapter.updateNodeInfo(instance);
} catch (ZookeeperException e) {
logger.error("Got exception while updating local node stats", e);
}
}
use of org.bboxdb.distribution.zookeeper.ZookeeperClient in project bboxdb by jnidzwetzki.
the class BBoxDBInstanceManager method stopMembershipObserver.
/**
* Stop the membership observer. This will send a delete event for all known
* instances if the membership observer was active.
*/
public synchronized void stopMembershipObserver() {
if (zookeeperBBoxDBInstanceAdapter != null) {
final ZookeeperClient zookeeper = zookeeperBBoxDBInstanceAdapter.getZookeeperClient();
zookeeper.getServiceState().removeCallback(zookeeperStartedCallback);
zookeeper.getServiceState().removeCallback(zookeeperShutdownCallback);
zookeeperBBoxDBInstanceAdapter = null;
}
zookeeperDisconnect();
}
Aggregations