Skip to content

Commit 0179530

Browse files
committed
wip
1 parent 40c3f19 commit 0179530

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

driver/src/main/java/org/neo4j/driver/exceptions/ConnectionReadTimeoutException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* Indicates that read timed out due to it taking longer than the server-supplied timeout value via the {@code connection.recv_timeout_seconds} configuration
2323
* hint. The server might provide this value to clients to let them know when a given connection may be considered broken if client does not get any
24-
* communication from the server within the specified timeout period.
24+
* communication from the server within the specified timeout period. This results in the server being removed from the routing table.
2525
*/
2626
public class ConnectionReadTimeoutException extends ServiceUnavailableException
2727
{

driver/src/main/java/org/neo4j/driver/internal/async/inbound/ConnectionReadTimeoutHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ protected void readTimedOut( ChannelHandlerContext ctx )
3939
{
4040
if ( !triggered )
4141
{
42-
// channel state management is handled in response handlers
4342
ctx.fireExceptionCaught( ConnectionReadTimeoutException.INSTANCE );
43+
ctx.close();
4444
triggered = true;
4545
}
4646
}

driver/src/test/java/org/neo4j/driver/internal/async/inbound/ConnectionReadTimeoutHandlerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ public class ConnectionReadTimeoutHandlerTest
3737
ChannelHandlerContext context = mock( ChannelHandlerContext.class );
3838

3939
@Test
40-
void shouldFireConnectionReadTimeoutExceptionOnReadTimeOutOnce()
40+
void shouldFireConnectionReadTimeoutExceptionAndCloseChannelOnReadTimeOutOnce()
4141
{
4242
// WHEN
4343
IntStream.range( 0, 10 ).forEach( i -> handler.readTimedOut( context ) );
4444

4545
// THEN
4646
then( context ).should( times( 1 ) ).fireExceptionCaught( any( ConnectionReadTimeoutException.class ) );
47+
then( context ).should( times( 1 ) ).close();
4748
}
4849
}

0 commit comments

Comments
 (0)