Skip to content

Commit

Permalink
[Java] Naming and consistency updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Jun 27, 2024
1 parent e48b2c8 commit e6f62bb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
11 changes: 6 additions & 5 deletions aeron-client/src/main/java/io/aeron/Aeron.java
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ public static class Context extends CommonContext
private UnavailableImageHandler unavailableImageHandler;
private AvailableCounterHandler availableCounterHandler;
private UnavailableCounterHandler unavailableCounterHandler;
private ErrorFrameListener errorFrameHandler = ErrorFrameListener.NO_OP;
private ErrorFrameHandler errorFrameHandler = ErrorFrameHandler.NO_OP;
private Runnable closeHandler;
private long keepAliveIntervalNs = Configuration.KEEPALIVE_INTERVAL_NS;
private long interServiceTimeoutNs = 0;
Expand Down Expand Up @@ -1669,18 +1669,19 @@ public ThreadFactory threadFactory()
* @param errorFrameHandler to be called back when an error frame is received.
* @return this for a fluent API.
*/
public Context errorFrameHandler(final ErrorFrameListener errorFrameHandler)
public Context errorFrameHandler(final ErrorFrameHandler errorFrameHandler)
{
this.errorFrameHandler = errorFrameHandler;
return this;
}

/**
* Get the handler used to report error frame received by this driver.
* Get the handler to receive error frames that have been received by the local driver for resources owned by
* this client.
*
* @return the {@link ErrorFrameListener} to call back on to.
* @return the {@link ErrorFrameHandler} to call back on to.
*/
public ErrorFrameListener errorFrameHandler()
public ErrorFrameHandler errorFrameHandler()
{
return this.errorFrameHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@
/**
* Interface for handling various error frame messages from different components in the client.
*/
public interface ErrorFrameListener
public interface ErrorFrameHandler
{
ErrorFrameListener NO_OP = new ErrorFrameListener()
ErrorFrameHandler NO_OP = new ErrorFrameHandler()
{
};

/**
* Called when an error frame is received by the local driver. E.g. when an image is invalidated. This callback will
* reuse the {@link PublicationErrorFrame} instance, so data is only valid for the lifetime of the callback. If the
* user needs to pass the data onto another thread or hold in another location for use later, then the user needs to
* make use of the {@link PublicationErrorFrame#clone()} method to create a copy for their own use.
* Called when an error frame received by the local driver is propagated to the clients. E.g. when an image is
* invalidated. This callback will reuse the {@link PublicationErrorFrame} instance, so data is only valid for the
* lifetime of the callback. If the user needs to pass the data onto another thread or hold in another location for
* use later, then the user needs to make use of the {@link PublicationErrorFrame#clone()} method to create a copy
* for their own use.
* <p>
* This callback will be executed on the client conductor thread, similar to image availability notifications.
*
* @param errorFrame contain the data from the error frame received by the publication.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public enum SystemCounterDescriptor
RETRANSMIT_OVERFLOW(37, "Retransmit Pool Overflow count"),

/**
* A count of the number of error messages received from a remote archive.
* A count of the number of error frames received by this driver.
*/
ERROR_FRAMES_RECEIVED(38, "Error Frames received");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private TestMediaDriver launch()
return driver;
}

private static final class QueuedErrorFrameListener implements ErrorFrameListener
private static final class QueuedErrorFrameHandler implements ErrorFrameHandler
{
private final OneToOneConcurrentArrayQueue<PublicationErrorFrame> errorFrameQueue =
new OneToOneConcurrentArrayQueue<>(512);
Expand All @@ -112,7 +112,7 @@ void shouldInvalidateSubscriptionsImage() throws IOException
context.imageLivenessTimeoutNs(TimeUnit.SECONDS.toNanos(3));

final TestMediaDriver driver = launch();
final QueuedErrorFrameListener errorFrameHandler = new QueuedErrorFrameListener();
final QueuedErrorFrameHandler errorFrameHandler = new QueuedErrorFrameHandler();

final Aeron.Context ctx = new Aeron.Context()
.aeronDirectoryName(driver.aeronDirectoryName())
Expand Down Expand Up @@ -202,8 +202,8 @@ void shouldOnlyReceivePublicationErrorFrameOnRelevantClient() throws IOException
context.imageLivenessTimeoutNs(TimeUnit.SECONDS.toNanos(3));

final TestMediaDriver driver = launch();
final QueuedErrorFrameListener errorFrameHandler1 = new QueuedErrorFrameListener();
final QueuedErrorFrameListener errorFrameHandler2 = new QueuedErrorFrameListener();
final QueuedErrorFrameHandler errorFrameHandler1 = new QueuedErrorFrameHandler();
final QueuedErrorFrameHandler errorFrameHandler2 = new QueuedErrorFrameHandler();

final Aeron.Context ctx1 = new Aeron.Context()
.aeronDirectoryName(driver.aeronDirectoryName())
Expand Down Expand Up @@ -367,7 +367,7 @@ void shouldReturnAllParametersToApi(final String addressStr) throws UnknownHostE
context.imageLivenessTimeoutNs(TimeUnit.SECONDS.toNanos(3));

final TestMediaDriver driver = launch();
final QueuedErrorFrameListener errorFrameHandler = new QueuedErrorFrameListener();
final QueuedErrorFrameHandler errorFrameHandler = new QueuedErrorFrameHandler();

final Aeron.Context ctx = new Aeron.Context()
.aeronDirectoryName(driver.aeronDirectoryName())
Expand Down

0 comments on commit e6f62bb

Please sign in to comment.