@Immutable public class Config extends Object implements Serializable
To build a simple config with custom logging implementation:
Config config = Config.builder()
.withLogging(new MyLogging())
.build();
To build a more complicated config with tuned connection pool options:
Config config = Config.builder()
.withEncryption()
.withConnectionTimeout( 10, TimeUnit.SECONDS)
.withMaxConnectionLifetime(30, TimeUnit.MINUTES)
.withMaxConnectionPoolSize(10)
.withConnectionAcquisitionTimeout(20, TimeUnit.SECONDS)
.build();
Modifier and Type | Class and Description |
---|---|
static class |
Config.ConfigBuilder
Used to build new config instances
|
static class |
Config.TrustStrategy
Control how the driver determines if it can trust the encryption certificates provided by the Neo4j instance it is connected to.
|
Modifier and Type | Method and Description |
---|---|
static Config.ConfigBuilder |
builder()
Start building a
Config object using a newly created builder. |
long |
connectionAcquisitionTimeoutMillis() |
int |
connectionTimeoutMillis() |
static Config |
defaultConfig() |
boolean |
encrypted() |
int |
eventLoopThreads() |
long |
fetchSize() |
long |
idleTimeBeforeConnectionTest()
Pooled connections that have been idle in the pool for longer than this timeout
will be tested before they are used again, to ensure they are still live.
|
boolean |
isMetricsEnabled() |
Logging |
logging()
Logging provider
|
boolean |
logLeakedSessions()
Check if leaked sessions logging is enabled.
|
long |
maxConnectionLifetimeMillis()
Pooled connections older than this threshold will be closed and removed from the pool.
|
int |
maxConnectionPoolSize() |
MetricsAdapter |
metricsAdapter() |
ServerAddressResolver |
resolver()
Server address resolver.
|
Config.TrustStrategy |
trustStrategy() |
String |
userAgent() |
public Logging logging()
public boolean logLeakedSessions()
true
if enabled, false
otherwise.public long idleTimeBeforeConnectionTest()
public long maxConnectionLifetimeMillis()
public int connectionTimeoutMillis()
public int maxConnectionPoolSize()
public long connectionAcquisitionTimeoutMillis()
public boolean encrypted()
public Config.TrustStrategy trustStrategy()
public ServerAddressResolver resolver()
public static Config.ConfigBuilder builder()
Config
object using a newly created builder.Config.ConfigBuilder
instance.public static Config defaultConfig()
public long fetchSize()
public int eventLoopThreads()
public boolean isMetricsEnabled()
public MetricsAdapter metricsAdapter()
public String userAgent()