Текущая конфигурация: < /p>
Код: Выделить всё
Properties props = new Properties();
props.setProperty("host", "griddb-server");
props.setProperty("port", "10001");
props.setProperty("clusterName", "myCluster");
props.setProperty("user", "admin");
props.setProperty("password", "admin");
// Connection pool settings
props.setProperty("maxConnectionPoolSize", "50");
props.setProperty("connectionTimeout", "30000");
// Creating connections in multiple threads
ExecutorService executor = Executors.newFixedThreadPool(20);
for (int i = 0; i < 100; i++) {
executor.submit(() -> {
try {
GridStore store = GridStoreFactory.getInstance().getGridStore(props);
Container container = store.getContainer("test_data");
container.put("key_" + Thread.currentThread().getId(), new Data());
store.close(); // Explicit close
} catch (GSException e) {
System.err.println("Error: " + e.getMessage());
// "Connection pool exhausted"
}
});
}
com.toshiba.mwcloud.gs.gsexception: Пул соединений. Несмотря на явные вызовы store.close ()?>
Подробнее здесь: https://stackoverflow.com/questions/797 ... -concurren