Caches configuration
This commit is contained in:
parent
f3afc6b700
commit
2f71aac235
|
@ -38,6 +38,9 @@ public abstract class MongoManager {
|
||||||
|
|
||||||
log.info("Got Mongo Client at "+client.getConnectPoint());
|
log.info("Got Mongo Client at "+client.getConnectPoint());
|
||||||
log.debug("Mongo client is "+client);
|
log.debug("Mongo client is "+client);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// NOT AUTHORIZED
|
// NOT AUTHORIZED
|
||||||
// log.debug("Existing databases "+client.getDatabaseNames());
|
// log.debug("Existing databases "+client.getDatabaseNames());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,13 @@ public class MongoClientProvider extends AbstractScopedMap<MongoClient>{
|
||||||
MongoCredential credential = MongoCredential.createCredential(conn.getUser(), conn.getDatabase(),
|
MongoCredential credential = MongoCredential.createCredential(conn.getUser(), conn.getDatabase(),
|
||||||
conn.getPassword().toCharArray());
|
conn.getPassword().toCharArray());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MongoClientOptions options = MongoClientOptions.builder().
|
MongoClientOptions options = MongoClientOptions.builder().
|
||||||
threadsAllowedToBlockForConnectionMultiplier(10).
|
threadsAllowedToBlockForConnectionMultiplier(10).
|
||||||
connectionsPerHost(20).
|
connectionsPerHost(20).
|
||||||
maxConnectionIdleTime(10000).
|
maxConnectionIdleTime(10000).
|
||||||
applicationName("geoportal-service").
|
applicationName("geoportal-service").
|
||||||
sslEnabled(true).
|
sslEnabled(true).
|
||||||
|
connectTimeout(30000).
|
||||||
build();
|
build();
|
||||||
|
|
||||||
return new MongoClient(new ServerAddress(conn.getHosts().get(0),conn.getPort()),
|
return new MongoClient(new ServerAddress(conn.getHosts().get(0),conn.getPort()),
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class StorageClientProvider extends AbstractScopedMap<StorageUtils> {
|
||||||
|
|
||||||
public StorageClientProvider() {
|
public StorageClientProvider() {
|
||||||
super("Storage client cache");
|
super("Storage client cache");
|
||||||
setTTL(Duration.of(10, ChronoUnit.MINUTES));
|
// setTTL(Duration.of(10, ChronoUnit.MINUTES));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,7 @@ public class StorageClientProvider extends AbstractScopedMap<StorageUtils> {
|
||||||
@Override
|
@Override
|
||||||
protected void dispose(StorageUtils toDispose) {
|
protected void dispose(StorageUtils toDispose) {
|
||||||
try {
|
try {
|
||||||
//TODO
|
toDispose.forceClose();
|
||||||
}catch (NullPointerException e) {
|
}catch (NullPointerException e) {
|
||||||
// expected if closed without uploading
|
// expected if closed without uploading
|
||||||
}catch(Throwable t) {
|
}catch(Throwable t) {
|
||||||
|
|
|
@ -96,4 +96,7 @@ public class Caches extends BasicServiceTestUnit {
|
||||||
if(executed.get()==launched.get()) service.shutdown();
|
if(executed.get()==launched.get()) service.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue