Skip to content

Commit

Permalink
[Java] Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Aug 9, 2024
1 parent fb263d8 commit a054780
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@

class ArchiveEventEncoderTest
{
enum State
{
ALPHA, BETA
}

private final UnsafeBuffer buffer = new UnsafeBuffer(new byte[MAX_EVENT_LENGTH]);

@Test
Expand Down Expand Up @@ -106,11 +111,6 @@ void testEncodeCatalogResize()
assertEquals(newCatalogLength, buffer.getLong(offset + LOG_HEADER_LENGTH + SIZE_OF_LONG));
}

enum State
{
ALPHA, BETA;
}

@Test
void testEncodeReplaySessionStateChange()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import static io.aeron.agent.AgentTests.verifyLogHeader;
import static io.aeron.agent.ClusterEventCode.*;
import static io.aeron.agent.ClusterEventEncoder.*;
import static io.aeron.agent.ClusterEventEncoder.MAX_REASON_LENGTH;
import static io.aeron.agent.CommonEventEncoder.LOG_HEADER_LENGTH;
import static io.aeron.agent.CommonEventEncoder.STATE_SEPARATOR;
import static io.aeron.agent.CommonEventEncoder.enumName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ private MediaDriver(final Context ctx)
sharedInvoker = null;
break;

default:
case DEDICATED:
default:
senderRunner = new AgentRunner(ctx.senderIdleStrategy(), errorHandler, errorCounter, sender);
receiverRunner = new AgentRunner(ctx.receiverIdleStrategy(), errorHandler, errorCounter, receiver);
conductorRunner = new AgentRunner(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,39 +496,37 @@ public void onSessionMessage(
}
}

if (ClusterTests.UNEXPECTED_MSG.equals(message))
switch (message)
{
hasReceivedUnexpectedMessage = true;
throw new IllegalStateException("unexpected message received");
}
case ClusterTests.UNEXPECTED_MSG:
hasReceivedUnexpectedMessage = true;
throw new IllegalStateException("unexpected message received");

if (ClusterTests.TERMINATE_MSG.equals(message))
{
throw new ClusterTerminationException(false);
}
case ClusterTests.TERMINATE_MSG:
throw new ClusterTerminationException(false);

if (ClusterTests.ECHO_SERVICE_IPC_INGRESS_MSG.equals(message))
{
sendServiceIpcMessage(session, buffer, offset, length);
}
else if (ClusterTests.ECHO_SERVICE_IPC_INGRESS_MSG_SKIP_FOLLOWER.equals(message))
{
simulateBuggyApplicationCodeThatSkipsServiceMessageOnFollower(session, buffer, offset, length);
}
else
{
if (ClusterTests.ERROR_MSG.equals(message))
{
cluster.context().errorHandler().onError(new Exception(message));
}
case ClusterTests.ECHO_SERVICE_IPC_INGRESS_MSG:
sendServiceIpcMessage(session, buffer, offset, length);
break;

if (null != session)
{
while (session.offer(buffer, offset, length) < 0)
case ClusterTests.ECHO_SERVICE_IPC_INGRESS_MSG_SKIP_FOLLOWER:
simulateBuggyApplicationCodeThatSkipsServiceMessageOnFollower(session, buffer, offset, length);
break;

default:
if (ClusterTests.ERROR_MSG.equals(message))
{
idleStrategy.idle();
cluster.context().errorHandler().onError(new Exception(message));
}
}

if (null != session)
{
while (session.offer(buffer, offset, length) < 0)
{
idleStrategy.idle();
}
}
break;
}

messageCount.incrementAndGet();
Expand Down

0 comments on commit a054780

Please sign in to comment.