Skip to content

Commit

Permalink
Minor cleanup/addressing PR feedback.
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Schohn <[email protected]>
  • Loading branch information
gregschohn committed Aug 29, 2023
1 parent fb7dccd commit 8d2313f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.opensearch.migrations.replay.util.StringTrackableCompletableFuture;

import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
Expand Down Expand Up @@ -59,11 +58,6 @@ public ChannelFuture load(final String s) {
});
}

NettyPacketToHttpConsumer createNettyHandler(String diagnosticLabel) {
return new NettyPacketToHttpConsumer(eventLoopGroup, serverUri, sslContext, diagnosticLabel);
}


public int getNumConnectionsCreated() {
return numConnectionsCreated.get();
}
Expand All @@ -88,7 +82,7 @@ public DiagnosticTrackableCompletableFuture<String,Void> stopGroup() {
try {
var channelClosedFuturesArray =
connectionId2ChannelCache.asMap().values().stream()
.map(this::closeChannel)
.map(this::closeClientConnectionChannel)
.collect(Collectors.toList());
StringTrackableCompletableFuture.<Channel>allOf(channelClosedFuturesArray.stream(),
() -> "all channels closed")

Check warning on line 88 in TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java

View check run for this annotation

Codecov / codecov/patch

TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java#L88

Added line #L88 was not covered by tests
Expand Down Expand Up @@ -141,13 +135,13 @@ public void closeConnection(String connId) {
log.atDebug().setMessage(()->"closing connection for " + connId).log();
var channelsFuture = connectionId2ChannelCache.getIfPresent(connId);

Check warning on line 136 in TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java

View check run for this annotation

Codecov / codecov/patch

TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java#L135-L136

Added lines #L135 - L136 were not covered by tests
if (channelsFuture != null) {
closeChannel(channelsFuture);
closeClientConnectionChannel(channelsFuture);
connectionId2ChannelCache.invalidate(connId);

Check warning on line 139 in TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java

View check run for this annotation

Codecov / codecov/patch

TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java#L138-L139

Added lines #L138 - L139 were not covered by tests
}
}

Check warning on line 141 in TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java

View check run for this annotation

Codecov / codecov/patch

TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java#L141

Added line #L141 was not covered by tests

private DiagnosticTrackableCompletableFuture<String, Channel>
closeChannel(ChannelFuture channelsFuture) {
closeClientConnectionChannel(ChannelFuture channelsFuture) {
var channelClosedFuture =
new StringTrackableCompletableFuture<>(new CompletableFuture<Channel>(),
()->"Waiting for closeFuture() on channel");

Check warning on line 147 in TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java

View check run for this annotation

Codecov / codecov/patch

TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/PacketToTransformingHttpHandlerFactory.java#L147

Added line #L147 was not covered by tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
status = error

# Root logger options
rootLogger.level = info
rootLogger.level = debug
rootLogger.appenderRef.console.ref = Console

# Console appender configuration
Expand Down

0 comments on commit 8d2313f

Please sign in to comment.