Skip to content

Commit

Permalink
Merge pull request fabric8io#2432 from manusa/fix/test-optimization-1
Browse files Browse the repository at this point in the history
  • Loading branch information
fusesource-ci committed Aug 25, 2020
2 parents b8c9f53 + 51bcc94 commit 35d78de
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 241 deletions.
Expand Up @@ -57,7 +57,7 @@ public class PortForwarderWebsocket implements PortForwarder {

private static final Logger LOG = LoggerFactory.getLogger(PortForwarderWebsocket.class);

private OkHttpClient client;
private final OkHttpClient client;

public PortForwarderWebsocket(OkHttpClient client) {
this.client = client;
Expand Down Expand Up @@ -193,7 +193,7 @@ public PortForward forward(URL resourceBaseUrl, int port, final ReadableByteChan

private int messagesRead = 0;

private ExecutorService pumperService = Executors.newSingleThreadExecutor();
private final ExecutorService pumperService = Executors.newSingleThreadExecutor();

@Override
public void onOpen(final WebSocket webSocket, Response response) {
Expand Down Expand Up @@ -298,7 +298,7 @@ public void onFailure(WebSocket webSocket, Throwable t, Response response) {
LOG.debug("{}: onFailure", logPrefix);
if (alive.get()) {
serverThrowables.add(t);
LOG.error(logPrefix + ": Throwable received from websocket", t);
LOG.error("{}: Throwable received from websocket", logPrefix, t);
closeForwarder();
}
}
Expand All @@ -321,14 +321,14 @@ private void closeForwarder() {
try {
in.close();
} catch (IOException e) {
LOG.error(logPrefix + ": Error while closing the client input channel", e);
LOG.error("{}: Error while closing the client input channel", logPrefix, e);
}
}
if (out != null && out != in) {
try {
out.close();
} catch (IOException e) {
LOG.error(logPrefix + ": Error while closing the client output channel", e);
LOG.error("{}: Error while closing the client output channel", logPrefix, e);
}
}
closeExecutor(pumperService);
Expand Down Expand Up @@ -388,6 +388,7 @@ public static void closeQuietly(Closeable... cloaseables) {
c.close();
}
} catch (IOException ioe) {
// Ignored
}
}
}
Expand Down

0 comments on commit 35d78de

Please sign in to comment.