Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
package org.elasticsearch.transport.netty4;

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.LogEvent;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.MockLog;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.transport.NodeDisconnectedException;
import org.elasticsearch.transport.TcpTransport;
import org.elasticsearch.transport.TransportLogger;

Expand Down Expand Up @@ -117,7 +119,15 @@ public void testExceptionalDisconnectLogging() throws Exception {
TcpTransport.class.getCanonicalName(),
Level.DEBUG,
".*closed transport connection \\[[1-9][0-9]*\\] to .* with age \\[[0-9]+ms\\], exception:.*"
)
) {
@Override
public void match(LogEvent event) {
if (event.getThrown() instanceof NodeDisconnectedException nodeDisconnectedException
&& nodeDisconnectedException.getMessage().contains("closed exceptionally: Netty4TcpChannel{")) {
super.match(event);
}
}
}
);

final String nodeName = internalCluster().startNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,15 +1134,15 @@ public void onResponse(Void v) {
nodeChannels.channels.forEach(ch -> {
// Mark the channel init time
ch.getChannelStats().markAccessed(relativeMillisTime);
ch.addCloseListener(new ActionListener<Void>() {
ch.addCloseListener(new ActionListener<>() {
@Override
public void onResponse(Void ignored) {
nodeChannels.close();
}

@Override
public void onFailure(Exception e) {
nodeChannels.closeAndFail(e);
nodeChannels.closeAndFail(new NodeDisconnectedException(node, "closed exceptionally: " + ch, null, e));
}
});
});
Expand Down