From cd3087832b498e9c97a472cf42de3b954490c1f4 Mon Sep 17 00:00:00 2001 From: Dmytro Vyazelenko <696855+vyazelenko@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:10:08 +0100 Subject: [PATCH] [Java] Rename `SEND_NAK_MESSAGE` to `NAK_SENT` so that it is symmetric with `NAK_SENT`. --- .../io/aeron/agent/ChannelEndpointInterceptor.java | 2 +- .../java/io/aeron/agent/DriverComponentLogger.java | 6 +++--- .../main/java/io/aeron/agent/DriverEventCode.java | 14 +++++++++++++- .../java/io/aeron/agent/DriverEventLoggerTest.java | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/aeron-agent/src/main/java/io/aeron/agent/ChannelEndpointInterceptor.java b/aeron-agent/src/main/java/io/aeron/agent/ChannelEndpointInterceptor.java index 89a39d0100..0d156dd57f 100644 --- a/aeron-agent/src/main/java/io/aeron/agent/ChannelEndpointInterceptor.java +++ b/aeron-agent/src/main/java/io/aeron/agent/ChannelEndpointInterceptor.java @@ -137,7 +137,7 @@ static void sendNakMessage( if (null != connection) { LOGGER.logNakMessage( - SEND_NAK_MESSAGE, + NAK_SENT, connection.controlAddress, sessionId, streamId, diff --git a/aeron-agent/src/main/java/io/aeron/agent/DriverComponentLogger.java b/aeron-agent/src/main/java/io/aeron/agent/DriverComponentLogger.java index 2217ce1370..67f917cf58 100644 --- a/aeron-agent/src/main/java/io/aeron/agent/DriverComponentLogger.java +++ b/aeron-agent/src/main/java/io/aeron/agent/DriverComponentLogger.java @@ -108,7 +108,7 @@ private static EnumSet getDriverEventCodes(final String enabled enabledEventCodes, SPECIAL_EVENTS, DriverEventCode::get, - DriverEventCode::valueOf); + DriverEventCode::get); } private static AgentBuilder addDriverConductorInstrumentation(final AgentBuilder agentBuilder) @@ -238,14 +238,14 @@ private AgentBuilder addChannelEndpointInstrumentation(final AgentBuilder agentB tempBuilder = addEventInstrumentation( tempBuilder, - SEND_NAK_MESSAGE, + NAK_SENT, "ReceiveChannelEndpoint", ChannelEndpointInterceptor.ReceiveChannelEndpointInterceptor.NakSent.class, "sendNakMessage"); tempBuilder = addEventInstrumentation( tempBuilder, - SEND_NAK_MESSAGE, + NAK_RECEIVED, "SendChannelEndpoint", ChannelEndpointInterceptor.SendChannelEndpointInterceptor.NakReceived.class, "onNakMessage"); diff --git a/aeron-agent/src/main/java/io/aeron/agent/DriverEventCode.java b/aeron-agent/src/main/java/io/aeron/agent/DriverEventCode.java index 504bff2c9b..182eef3246 100644 --- a/aeron-agent/src/main/java/io/aeron/agent/DriverEventCode.java +++ b/aeron-agent/src/main/java/io/aeron/agent/DriverEventCode.java @@ -205,7 +205,7 @@ public enum DriverEventCode implements EventCode /** * Nak sent. */ - SEND_NAK_MESSAGE(54, DriverEventDissector::dissectNak), + NAK_SENT(54, DriverEventDissector::dissectNak), /** * Resend data upon Nak. @@ -284,6 +284,18 @@ static DriverEventCode get(final int id) return code; } + static DriverEventCode get(final String name) + { + if ("SEND_NAK_MESSAGE".equals(name)) + { + return NAK_SENT; + } + else + { + return DriverEventCode.valueOf(name); + } + } + /** * Decode an event serialised in a buffer to a provided {@link StringBuilder}. * diff --git a/aeron-agent/src/test/java/io/aeron/agent/DriverEventLoggerTest.java b/aeron-agent/src/test/java/io/aeron/agent/DriverEventLoggerTest.java index e6a4557c06..81da980113 100644 --- a/aeron-agent/src/test/java/io/aeron/agent/DriverEventLoggerTest.java +++ b/aeron-agent/src/test/java/io/aeron/agent/DriverEventLoggerTest.java @@ -389,7 +389,7 @@ void logHost() } @ParameterizedTest - @EnumSource(value = DriverEventCode.class, names = { "SEND_NAK_MESSAGE", "NAK_RECEIVED" }) + @EnumSource(value = DriverEventCode.class, names = { "NAK_SENT", "NAK_RECEIVED" }) void logNakMessage(final DriverEventCode eventCode) { final InetSocketAddress inetSocketAddress = new InetSocketAddress("192.168.1.1", 10001);