use of io.deephaven.configuration.Configuration in project deephaven-core by deephaven.
the class HeapDump method generateHeapDumpPath.
public static String generateHeapDumpPath() {
final Configuration configuration = Configuration.getInstance();
final String processName = configuration.getProcessName();
return configuration.getLogPath(processName + "_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date(System.currentTimeMillis())) + ".hprof");
}
use of io.deephaven.configuration.Configuration in project deephaven-core by deephaven.
the class NettyMain method main.
public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException, TimeoutException {
final Configuration config = init(args, Main.class);
// defaults to 5 minutes
int httpSessionExpireMs = config.getIntegerWithDefault("http.session.durationMs", 300000);
int httpPort = config.getIntegerWithDefault("http.port", 8080);
int schedulerPoolSize = config.getIntegerWithDefault("scheduler.poolSize", 4);
int maxInboundMessageSize = config.getIntegerWithDefault("grpc.maxInboundMessageSize", 100 * 1024 * 1024);
DaggerNettyServerComponent.builder().withPort(httpPort).withSchedulerPoolSize(schedulerPoolSize).withSessionTokenExpireTmMs(httpSessionExpireMs).withMaxInboundMessageSize(maxInboundMessageSize).withOut(PrintStreamGlobals.getOut()).withErr(PrintStreamGlobals.getErr()).build().getServer().run().join();
}
use of io.deephaven.configuration.Configuration in project deephaven-core by deephaven.
the class PropertySaverTest method propertySaverRemoveSomeProp.
@Test
public void propertySaverRemoveSomeProp() throws Exception {
Configuration configuration = Configuration.getInstance();
final int initialSize = configuration.getProperties().size();
log.info().append("configuration initialSize: " + initialSize).endl();
Assert.assertTrue(initialSize > 0);
final PropertySaver propertySaver = new PropertySaver();
try {
final String someProperty = configuration.getProperties().stringPropertyNames().iterator().next();
log.info().append("Remove someProperty: " + someProperty).endl();
propertySaver.remove(someProperty);
log.info().append("configuration currentSize: " + configuration.getProperties().size()).endl();
Assert.assertEquals(configuration.getProperties().size(), initialSize - 1);
} finally {
propertySaver.restore();
log.info().append("configuration restored size: " + configuration.getProperties().size()).endl();
Assert.assertEquals(initialSize, configuration.getProperties().size());
}
}
use of io.deephaven.configuration.Configuration in project deephaven-core by deephaven.
the class PropertySaverTest method propertySaverRemoveAllProps.
@Test
public void propertySaverRemoveAllProps() throws Exception {
Configuration configuration = Configuration.getInstance();
final int initialSize = configuration.getProperties().size();
log.info().append("configuration initialSize: " + initialSize).endl();
Assert.assertTrue(initialSize > 0);
final PropertySaver propertySaver = new PropertySaver();
try {
Set<String> props = configuration.getProperties().stringPropertyNames();
props.forEach((k) -> propertySaver.remove(k));
log.info().append("configuration currentSize: " + configuration.getProperties().size()).endl();
Assert.assertEquals(configuration.getProperties().size(), 0);
} finally {
propertySaver.restore();
log.info().append("configuration restored size: " + configuration.getProperties().size()).endl();
Assert.assertEquals(initialSize, configuration.getProperties().size());
}
}
use of io.deephaven.configuration.Configuration in project deephaven-core by deephaven.
the class PropertySaverTest method propertySaverRemoveNonExistentProp.
@Test
public void propertySaverRemoveNonExistentProp() throws Exception {
Configuration configuration = Configuration.getInstance();
final int initialSize = configuration.getProperties().size();
log.info().append("configuration initialSize: " + initialSize).endl();
Assert.assertTrue(initialSize > 0);
final PropertySaver propertySaver = new PropertySaver();
try {
final String randomProperty = UUID.randomUUID().toString();
try {
// trying to get a non-existent property throws a PropertyException
configuration.getProperty(randomProperty);
} catch (Throwable th) {
assertThat(th, instanceOf(PropertyException.class));
log.info().append("====> Got expected exception: " + th).endl();
}
log.info().append("Remove random (non-existing) Property: " + randomProperty).endl();
propertySaver.remove(randomProperty);
log.info().append("configuration currentSize: " + configuration.getProperties().size()).endl();
Assert.assertEquals(configuration.getProperties().size(), initialSize);
} finally {
propertySaver.restore();
log.info().append("configuration restored size: " + configuration.getProperties().size()).endl();
Assert.assertEquals(initialSize, configuration.getProperties().size());
}
}
Aggregations