Replace try with try-with-resources
Update existing try/finally/close blocks to use "try with resources" See gh-9781
This commit is contained in:
committed by
Phillip Webb
parent
798fe5ed53
commit
d16af43664
@@ -170,10 +170,9 @@ public class TunnelClient implements SmartInitializingSingleton {
|
||||
|
||||
private void handleConnection(SocketChannel socketChannel) throws Exception {
|
||||
Closeable closeable = new SocketCloseable(socketChannel);
|
||||
WritableByteChannel outputChannel = TunnelClient.this.tunnelConnection
|
||||
.open(socketChannel, closeable);
|
||||
TunnelClient.this.listeners.fireOpenEvent(socketChannel);
|
||||
try {
|
||||
try (WritableByteChannel outputChannel = TunnelClient.this.tunnelConnection
|
||||
.open(socketChannel, closeable)) {
|
||||
logger.trace("Accepted connection to tunnel client from "
|
||||
+ socketChannel.socket().getRemoteSocketAddress());
|
||||
while (true) {
|
||||
@@ -189,9 +188,6 @@ public class TunnelClient implements SmartInitializingSingleton {
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
outputChannel.close();
|
||||
}
|
||||
}
|
||||
|
||||
protected void stopAcceptingConnections() {
|
||||
|
||||
Reference in New Issue
Block a user