java.lang.Object
org.neo4j.driver.Config
- All Implemented Interfaces:
Serializable
A configuration class to config driver properties.
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();
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classUsed to build new config instancesstatic final classControl how the driver determines if it can trust the encryption certificates provided by the Neo4j instance it is connected to. -
Method Summary
Modifier and TypeMethodDescriptionstatic Config.ConfigBuilderbuilder()Start building aConfigobject using a newly created builder.longintstatic ConfigbooleanintlonglongPooled 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.booleanlogging()Logging providerbooleanCheck if leaked sessions logging is enabled.longPooled connections older than this threshold will be closed and removed from the pool.intlongReturns managed transactions maximum retry time.resolver()Server address resolver.longReturns stale routing table purge delay.
-
Method Details
-
logging
Logging provider- Returns:
- the Logging provider to use
-
logLeakedSessions
public boolean logLeakedSessions()Check if leaked sessions logging is enabled.- Returns:
trueif enabled,falseotherwise.
-
idleTimeBeforeConnectionTest
public 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.- Returns:
- idle time in milliseconds
-
maxConnectionLifetimeMillis
public long maxConnectionLifetimeMillis()Pooled connections older than this threshold will be closed and removed from the pool.- Returns:
- maximum lifetime in milliseconds
-
connectionTimeoutMillis
public int connectionTimeoutMillis()- Returns:
- the configured connection timeout value in milliseconds.
-
maxConnectionPoolSize
public int maxConnectionPoolSize() -
connectionAcquisitionTimeoutMillis
public long connectionAcquisitionTimeoutMillis() -
encrypted
public boolean encrypted()- Returns:
- indicator for encrypted communication.
-
trustStrategy
- Returns:
- the strategy to use to determine the authenticity of an encryption certificate provided by the Neo4j instance we are connecting to.
-
resolver
Server address resolver.- Returns:
- the resolver to use.
-
builder
Start building aConfigobject using a newly created builder.- Returns:
- a new
Config.ConfigBuilderinstance.
-
defaultConfig
- Returns:
- A config with all default settings
-
routingTablePurgeDelayMillis
public long routingTablePurgeDelayMillis()Returns stale routing table purge delay.- Returns:
- routing table purge delay
-
maxTransactionRetryTimeMillis
public long maxTransactionRetryTimeMillis()Returns managed transactions maximum retry time.- Returns:
- maximum retry time
-
fetchSize
public long fetchSize() -
eventLoopThreads
public int eventLoopThreads() -
isMetricsEnabled
public boolean isMetricsEnabled()- Returns:
- if the metrics is enabled or not on this driver.
-
metricsAdapter
-
userAgent
- Returns:
- the user_agent configured for this driver
-