Skip to content

Update driver version and DriverFactory #1613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchkit-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>neo4j-java-driver-parent</artifactId>
<groupId>org.neo4j.driver</groupId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>benchkit-backend</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-api-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-api-netty</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-api-pooled/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-api-pooled</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-api-routed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-api-routed</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-api-test-values/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-api-test-values</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bolt-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-bolt-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>neo4j-java-driver</artifactId>
Expand Down
89 changes: 55 additions & 34 deletions driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private InternalDriver createDriver(
try {
var homeDatabaseCache =
HomeDatabaseCache.newInstance(uri.getScheme().startsWith("neo4j"));
boltConnectionProvider = createBoltConnectionProvider(
boltConnectionProvider = createDriverBoltConnectionProvider(
uri,
config,
eventLoopGroup,
Expand Down Expand Up @@ -223,7 +223,7 @@ private Function<BoltServerAddress, Set<BoltServerAddress>> createBoltServerAddr
.collect(Collectors.toCollection(LinkedHashSet::new));
}

private DriverBoltConnectionProvider createBoltConnectionProvider(
private DriverBoltConnectionProvider createDriverBoltConnectionProvider(
URI uri,
Config config,
EventLoopGroup eventLoopGroup,
Expand All @@ -236,8 +236,48 @@ private DriverBoltConnectionProvider createBoltConnectionProvider(
String userAgent,
int connectTimeoutMillis,
MetricsListener metricsListener) {
DriverBoltConnectionProvider boltConnectionProvider;
var clock = createClock();
var boltConnectionProvider = createBoltConnectionProvider(
uri,
config,
eventLoopGroup,
routingSettings,
rediscoverySupplier,
boltConnectionListener,
address,
routingContext,
boltAgent,
userAgent,
connectTimeoutMillis,
metricsListener,
clock);
return new AdaptingDriverBoltConnectionProvider(
boltConnectionProvider,
ErrorMapper.getInstance(),
BoltValueFactory.getInstance(),
uri.getScheme().startsWith("neo4j"),
address,
routingContext,
boltAgent,
userAgent,
connectTimeoutMillis);
}

protected BoltConnectionProvider createBoltConnectionProvider(
URI uri,
Config config,
EventLoopGroup eventLoopGroup,
RoutingSettings routingSettings,
Supplier<Rediscovery> rediscoverySupplier,
BoltConnectionListener boltConnectionListener,
BoltServerAddress address,
RoutingContext routingContext,
BoltAgent boltAgent,
String userAgent,
int connectTimeoutMillis,
MetricsListener metricsListener,
Clock clock) {
BoltConnectionProvider boltConnectionProvider;
var loggingProvider = new BoltLoggingProvider(config.logging());
Function<BoltServerAddress, BoltConnectionProvider> pooledBoltConnectionProviderSupplier =
selectedAddress -> createPooledBoltConnectionProvider(
Expand All @@ -252,42 +292,23 @@ private DriverBoltConnectionProvider createBoltConnectionProvider(
userAgent,
connectTimeoutMillis,
metricsListener);
var errorMapper = ErrorMapper.getInstance();
if (uri.getScheme().startsWith("bolt")) {
assertNoRoutingContext(uri, routingSettings);
boltConnectionProvider = new AdaptingDriverBoltConnectionProvider(
pooledBoltConnectionProviderSupplier.apply(address),
errorMapper,
BoltValueFactory.getInstance(),
false,
if (uri.getScheme().startsWith("neo4j")) {
boltConnectionProvider = createRoutedBoltConnectionProvider(
config,
pooledBoltConnectionProviderSupplier,
routingSettings,
rediscoverySupplier,
clock,
loggingProvider,
address,
routingContext,
boltAgent,
userAgent,
connectTimeoutMillis);
connectTimeoutMillis,
metricsListener);
} else {
boltConnectionProvider = new AdaptingDriverBoltConnectionProvider(
createRoutedBoltConnectionProvider(
config,
pooledBoltConnectionProviderSupplier,
routingSettings,
rediscoverySupplier,
clock,
loggingProvider,
address,
routingContext,
boltAgent,
userAgent,
connectTimeoutMillis,
metricsListener),
errorMapper,
BoltValueFactory.getInstance(),
true,
address,
routingContext,
boltAgent,
userAgent,
connectTimeoutMillis);
assertNoRoutingContext(uri, routingSettings);
boltConnectionProvider = pooledBoltConnectionProviderSupplier.apply(address);
}
return boltConnectionProvider;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<groupId>org.neo4j.doc.driver</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>

<packaging>pom</packaging>
<name>Neo4j Java Driver Project</name>
Expand Down
2 changes: 1 addition & 1 deletion testkit-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<artifactId>neo4j-java-driver-parent</artifactId>
<groupId>org.neo4j.driver</groupId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
</parent>

<artifactId>testkit-backend</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion testkit-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver-parent</artifactId>
<version>5.27-SNAPSHOT</version>
<version>5.28-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

Expand Down