use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.
the class TestDistributedInstanceManager method testWriteSystemInfo.
/**
* Test write the system info
*/
@Test(timeout = 60000)
public void testWriteSystemInfo() {
final BBoxDBInstance instance1 = new BBoxDBInstance("node6:5050");
final ZookeeperClient zookeeperClient1 = getNewZookeeperClient(instance1);
BBoxDBInstanceManager.getInstance().startMembershipObserver(zookeeperClient1);
final List<BBoxDBInstance> distributedInstances = BBoxDBInstanceManager.getInstance().getInstances();
Assert.assertEquals(1, distributedInstances.size());
final BBoxDBInstance instance = distributedInstances.get(0);
Assert.assertEquals(SystemInfo.getAvailableMemory(), instance.getMemory());
Assert.assertEquals(SystemInfo.getCPUCores(), instance.getCpuCores());
final BBoxDBConfiguration bboxDBConfiguration = BBoxDBConfigurationManager.getConfiguration();
final List<String> directories = bboxDBConfiguration.getStorageDirectories();
Assert.assertEquals(directories.size(), instance.getNumberOfStorages());
Assert.assertEquals(directories.size(), instance.getAllTotalSpaceLocations().size());
Assert.assertEquals(directories.size(), instance.getAllFreeSpaceLocations().size());
for (final String directory : directories) {
final File path = new File(directory);
Assert.assertEquals(SystemInfo.getFreeDiskspace(path), (long) instance.getAllFreeSpaceLocations().get(directory), 1000000);
Assert.assertEquals(SystemInfo.getTotalDiskspace(path), (long) instance.getAllTotalSpaceLocations().get(directory), 1000000);
}
zookeeperClient1.shutdown();
}
use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.
the class ZookeeperClientFactory method getZookeeperClient.
/**
* Returns a new instance of the zookeeper client
* @return
*/
public static synchronized ZookeeperClient getZookeeperClient() {
if (client == null) {
final BBoxDBConfiguration bboxdbConfiguration = BBoxDBConfigurationManager.getConfiguration();
final Collection<String> zookeepernodes = bboxdbConfiguration.getZookeepernodes();
final String clustername = bboxdbConfiguration.getClustername();
client = new ZookeeperClient(zookeepernodes, clustername);
}
if (!client.isConnected()) {
client.init();
}
return client;
}
use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.
the class SSTableServiceRunnable method openFacades.
/**
* Open the facades
*
* @param newTableWriter
* @param newFacades
* @throws StorageManagerException
*/
private void openFacades(final List<SSTableWriter> newTableWriter, final List<SSTableFacade> newFacades) throws StorageManagerException {
for (final SSTableWriter writer : newTableWriter) {
final TupleStoreManagerRegistry tupleStoreManagerRegistry = storage.getTupleStoreManagerRegistry();
final BBoxDBConfiguration configuration = tupleStoreManagerRegistry.getConfiguration();
final int sstableKeyCacheEntries = configuration.getSstableKeyCacheEntries();
final SSTableFacade newFacade = new SSTableFacade(writer.getDirectory(), writer.getName(), writer.getTablenumber(), sstableKeyCacheEntries);
newFacades.add(newFacade);
}
}
use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.
the class DiskStorage method startCheckpointThread.
/**
* Start the checkpoint thread for the storage
*/
private void startCheckpointThread() {
final BBoxDBConfiguration configuration = tupleStoreManagerRegistry.getConfiguration();
if (configuration.getStorageCheckpointInterval() > 0) {
final int maxUncheckpointedSeconds = configuration.getStorageCheckpointInterval();
final SSTableCheckpointRunnable ssTableCheckpointThread = new SSTableCheckpointRunnable(this, maxUncheckpointedSeconds);
final Thread checkpointThread = new Thread(ssTableCheckpointThread);
checkpointThread.setName("Checkpoint thread for: " + basedir);
checkpointThread.start();
runningThreads.add(checkpointThread);
}
}
use of org.bboxdb.misc.BBoxDBConfiguration in project bboxdb by jnidzwetzki.
the class PerformanceCounterService method init.
@Override
public void init() throws InterruptedException, BBoxDBException {
final BBoxDBConfiguration bboxDBConfiguration = BBoxDBConfigurationManager.getConfiguration();
final int port = bboxDBConfiguration.getPerformanceCounterPort();
// Service is disabled
if (port == -1) {
logger.info("Performance counter service is disabled");
return;
}
logger.info("Starting performance counter service on port: {}", port);
// Expose JVM stats
DefaultExports.initialize();
try {
server = new HTTPServer(port);
} catch (IOException e) {
logger.error("Got an exception during starting up performance counter HTTP sever", e);
}
}
Aggregations