Skip to content

Commit 9c04445

Browse files
committed
wip
1 parent 2e22034 commit 9c04445

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

driver/src/main/java/org/neo4j/driver/internal/async/pool/NettyChannelHealthChecker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ public class NettyChannelHealthChecker implements ChannelHealthChecker, Authoriz
4242
{
4343
private final PoolSettings poolSettings;
4444
private final Clock clock;
45+
private final Logging logging;
4546
private final Logger log;
4647
private final AtomicReference<Optional<Long>> minCreationTimestampMillisOpt;
4748

4849
public NettyChannelHealthChecker( PoolSettings poolSettings, Clock clock, Logging logging )
4950
{
5051
this.poolSettings = poolSettings;
5152
this.clock = clock;
53+
this.logging = logging;
5254
this.log = logging.getLog( getClass() );
5355
this.minCreationTimestampMillisOpt = new AtomicReference<>( Optional.empty() );
5456
}
@@ -129,7 +131,7 @@ private boolean hasBeenIdleForTooLong( Channel channel )
129131
private Future<Boolean> ping( Channel channel )
130132
{
131133
Promise<Boolean> result = channel.eventLoop().newPromise();
132-
messageDispatcher( channel ).enqueue( new PingResponseHandler( result, channel, log ) );
134+
messageDispatcher( channel ).enqueue( new PingResponseHandler( result, channel, logging ) );
133135
channel.writeAndFlush( ResetMessage.RESET, channel.voidPromise() );
134136
return result;
135137
}

driver/src/main/java/org/neo4j/driver/internal/cluster/RoutingTableHandlerImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.concurrent.CompletionStage;
2626

2727
import org.neo4j.driver.Logger;
28+
import org.neo4j.driver.Logging;
2829
import org.neo4j.driver.internal.BoltServerAddress;
2930
import org.neo4j.driver.internal.DatabaseName;
3031
import org.neo4j.driver.internal.async.ConnectionContext;
@@ -45,15 +46,16 @@ public class RoutingTableHandlerImpl implements RoutingTableHandler
4546
private final long routingTablePurgeDelayMs;
4647
private final Set<BoltServerAddress> resolvedInitialRouters = new HashSet<>();
4748

48-
public RoutingTableHandlerImpl( RoutingTable routingTable, Rediscovery rediscovery, ConnectionPool connectionPool, RoutingTableRegistry routingTableRegistry,
49-
Logger log, long routingTablePurgeDelayMs )
49+
public RoutingTableHandlerImpl( RoutingTable routingTable, Rediscovery rediscovery, ConnectionPool connectionPool,
50+
RoutingTableRegistry routingTableRegistry,
51+
Logging logging, long routingTablePurgeDelayMs )
5052
{
5153
this.routingTable = routingTable;
5254
this.databaseName = routingTable.database();
5355
this.rediscovery = rediscovery;
5456
this.connectionPool = connectionPool;
5557
this.routingTableRegistry = routingTableRegistry;
56-
this.log = log;
58+
this.log = logging.getLog( getClass() );
5759
this.routingTablePurgeDelayMs = routingTablePurgeDelayMs;
5860
}
5961

driver/src/main/java/org/neo4j/driver/internal/cluster/RoutingTableRegistryImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static class RoutingTableHandlerFactory
121121
{
122122
private final ConnectionPool connectionPool;
123123
private final Rediscovery rediscovery;
124+
private final Logging logging;
124125
private final Logger log;
125126
private final Clock clock;
126127
private final long routingTablePurgeDelayMs;
@@ -130,14 +131,15 @@ static class RoutingTableHandlerFactory
130131
this.connectionPool = connectionPool;
131132
this.rediscovery = rediscovery;
132133
this.clock = clock;
134+
this.logging = logging;
133135
this.log = logging.getLog( getClass() );
134136
this.routingTablePurgeDelayMs = routingTablePurgeDelayMs;
135137
}
136138

137139
RoutingTableHandler newInstance( DatabaseName databaseName, RoutingTableRegistry allTables )
138140
{
139141
ClusterRoutingTable routingTable = new ClusterRoutingTable( databaseName, clock );
140-
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, allTables, log, routingTablePurgeDelayMs );
142+
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, allTables, logging, routingTablePurgeDelayMs );
141143
}
142144
}
143145
}

driver/src/main/java/org/neo4j/driver/internal/handlers/PingResponseHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,22 @@
2323

2424
import java.util.Map;
2525

26-
import org.neo4j.driver.internal.spi.ResponseHandler;
2726
import org.neo4j.driver.Logger;
27+
import org.neo4j.driver.Logging;
2828
import org.neo4j.driver.Value;
29+
import org.neo4j.driver.internal.spi.ResponseHandler;
2930

3031
public class PingResponseHandler implements ResponseHandler
3132
{
3233
private final Promise<Boolean> result;
3334
private final Channel channel;
3435
private final Logger log;
3536

36-
public PingResponseHandler( Promise<Boolean> result, Channel channel, Logger log )
37+
public PingResponseHandler( Promise<Boolean> result, Channel channel, Logging logging )
3738
{
3839
this.result = result;
3940
this.channel = channel;
40-
this.log = log;
41+
this.log = logging.getLog( getClass() );
4142
}
4243

4344
@Override

driver/src/test/java/org/neo4j/driver/internal/cluster/RoutingTableHandlerTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import static org.neo4j.driver.internal.async.ImmutableConnectionContext.simple;
6060
import static org.neo4j.driver.internal.cluster.RediscoveryUtil.contextWithMode;
6161
import static org.neo4j.driver.internal.cluster.RoutingSettings.STALE_ROUTING_TABLE_PURGE_DELAY_MS;
62-
import static org.neo4j.driver.internal.logging.DevNullLogger.DEV_NULL_LOGGER;
62+
import static org.neo4j.driver.internal.logging.DevNullLogging.DEV_NULL_LOGGING;
6363
import static org.neo4j.driver.internal.util.ClusterCompositionUtil.A;
6464
import static org.neo4j.driver.internal.util.ClusterCompositionUtil.B;
6565
import static org.neo4j.driver.internal.util.ClusterCompositionUtil.C;
@@ -308,13 +308,14 @@ private static ConnectionPool newConnectionPoolMockWithFailures(
308308

309309
private static RoutingTableHandler newRoutingTableHandler( RoutingTable routingTable, Rediscovery rediscovery, ConnectionPool connectionPool )
310310
{
311-
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, newRoutingTableRegistryMock(), DEV_NULL_LOGGER,
312-
STALE_ROUTING_TABLE_PURGE_DELAY_MS );
311+
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, newRoutingTableRegistryMock(), DEV_NULL_LOGGING,
312+
STALE_ROUTING_TABLE_PURGE_DELAY_MS );
313313
}
314314

315315
private static RoutingTableHandler newRoutingTableHandler( RoutingTable routingTable, Rediscovery rediscovery, ConnectionPool connectionPool,
316316
RoutingTableRegistry routingTableRegistry )
317317
{
318-
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, routingTableRegistry, DEV_NULL_LOGGER, STALE_ROUTING_TABLE_PURGE_DELAY_MS );
318+
return new RoutingTableHandlerImpl( routingTable, rediscovery, connectionPool, routingTableRegistry, DEV_NULL_LOGGING,
319+
STALE_ROUTING_TABLE_PURGE_DELAY_MS );
319320
}
320321
}

driver/src/test/java/org/neo4j/driver/internal/handlers/PingResponseHandlerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import static org.junit.jupiter.api.Assertions.assertThrows;
3131
import static org.junit.jupiter.api.Assertions.assertTrue;
3232
import static org.mockito.Mockito.mock;
33-
import static org.neo4j.driver.internal.logging.DevNullLogger.DEV_NULL_LOGGER;
33+
import static org.neo4j.driver.internal.logging.DevNullLogging.DEV_NULL_LOGGING;
3434

3535
class PingResponseHandlerTest
3636
{
@@ -73,6 +73,6 @@ private static Promise<Boolean> newPromise()
7373

7474
private static PingResponseHandler newHandler( Promise<Boolean> result )
7575
{
76-
return new PingResponseHandler( result, mock( Channel.class ), DEV_NULL_LOGGER );
76+
return new PingResponseHandler( result, mock( Channel.class ), DEV_NULL_LOGGING );
7777
}
7878
}

0 commit comments

Comments
 (0)