Skip to content

Commit

Permalink
[Java] Rename SEND_NAK_MESSAGE to NAK_SENT so that it is symmetri…
Browse files Browse the repository at this point in the history
…c with `NAK_SENT`.
  • Loading branch information
vyazelenko committed Jan 7, 2025
1 parent 7cc8bf0 commit cd30878
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static void sendNakMessage(
if (null != connection)
{
LOGGER.logNakMessage(
SEND_NAK_MESSAGE,
NAK_SENT,
connection.controlAddress,
sessionId,
streamId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static EnumSet<DriverEventCode> getDriverEventCodes(final String enabled
enabledEventCodes,
SPECIAL_EVENTS,
DriverEventCode::get,
DriverEventCode::valueOf);
DriverEventCode::get);
}

private static AgentBuilder addDriverConductorInstrumentation(final AgentBuilder agentBuilder)
Expand Down Expand Up @@ -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");
Expand Down
14 changes: 13 additions & 1 deletion aeron-agent/src/main/java/io/aeron/agent/DriverEventCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd30878

Please sign in to comment.