Skip to content

Commit

Permalink
[Java] Trying to be consistent with naming of adapters.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jul 23, 2017
1 parent ec4cc22 commit 7d6412b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions aeron-client/src/main/java/io/aeron/ClientConductor.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* Client conductor takes responses and notifications from Media Driver and acts on them in addition to forwarding
* commands from the various Client APIs to the Media Driver.
*/
class ClientConductor implements Agent, DriverListener
class ClientConductor implements Agent, DriverEventsListener
{
private static final long NO_CORRELATION_ID = -1;
private static final long RESOURCE_TIMEOUT_NS = TimeUnit.SECONDS.toNanos(1);
Expand All @@ -59,7 +59,7 @@ class ClientConductor implements Agent, DriverListener
private final EpochClock epochClock;
private final FileChannel.MapMode imageMapMode;
private final NanoClock nanoClock;
private final DriverListenerAdapter driverListener;
private final DriverEventsAdapter driverEventsAdapter;
private final LogBuffersFactory logBuffersFactory;
private final ActivePublications activePublications = new ActivePublications();
private final Long2ObjectHashMap<ExclusivePublication> activeExclusivePublications = new Long2ObjectHashMap<>();
Expand Down Expand Up @@ -91,7 +91,7 @@ class ClientConductor implements Agent, DriverListener
publicationConnectionTimeoutMs = ctx.publicationConnectionTimeout();
defaultAvailableImageHandler = ctx.availableImageHandler();
defaultUnavailableImageHandler = ctx.unavailableImageHandler();
driverListener = new DriverListenerAdapter(ctx.toClientBuffer(), this);
driverEventsAdapter = new DriverEventsAdapter(ctx.toClientBuffer(), this);
driverAgentInvoker = ctx.driverAgentInvoker();

final long nowNs = nanoClock.nanoTime();
Expand Down Expand Up @@ -403,9 +403,9 @@ public void onUnavailableImage(final long correlationId, final int streamId)
});
}

DriverListenerAdapter driverListenerAdapter()
DriverEventsAdapter driverListenerAdapter()
{
return driverListener;
return driverEventsAdapter;
}

void lingerResource(final ManagedResource managedResource)
Expand All @@ -426,7 +426,7 @@ private int doWork(final long correlationId, final String expectedChannel)
try
{
workCount += onCheckTimeouts();
workCount += driverListener.pollMessage(correlationId, expectedChannel);
workCount += driverEventsAdapter.receive(correlationId, expectedChannel);
}
catch (final AgentTerminationException ex)
{
Expand Down Expand Up @@ -468,7 +468,7 @@ private void awaitResponse(final long correlationId, final String expectedChanne

doWork(correlationId, expectedChannel);

if (driverListener.lastReceivedCorrelationId() == correlationId)
if (driverEventsAdapter.lastReceivedCorrelationId() == correlationId)
{
if (null != driverException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Analogue of {@link DriverProxy} on the client side
*/
class DriverListenerAdapter implements MessageHandler
class DriverEventsAdapter implements MessageHandler
{
private final CopyBroadcastReceiver broadcastReceiver;

Expand All @@ -34,19 +34,19 @@ class DriverListenerAdapter implements MessageHandler
private final ImageBuffersReadyFlyweight imageReady = new ImageBuffersReadyFlyweight();
private final CorrelatedMessageFlyweight correlatedMessage = new CorrelatedMessageFlyweight();
private final ImageMessageFlyweight imageMessage = new ImageMessageFlyweight();
private final DriverListener listener;
private final DriverEventsListener listener;

private long activeCorrelationId;
private long lastReceivedCorrelationId;
private String expectedChannel;

DriverListenerAdapter(final CopyBroadcastReceiver broadcastReceiver, final DriverListener listener)
DriverEventsAdapter(final CopyBroadcastReceiver broadcastReceiver, final DriverEventsListener listener)
{
this.broadcastReceiver = broadcastReceiver;
this.listener = listener;
}

public int pollMessage(final long activeCorrelationId, final String expectedChannel)
public int receive(final long activeCorrelationId, final String expectedChannel)
{
this.activeCorrelationId = activeCorrelationId;
this.lastReceivedCorrelationId = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
package io.aeron;

/**
* Callback interface for dispatching command responses from the driver on the control protocol.
* Callback interface for dispatching driver events on the control protocol.
*/
interface DriverListener
interface DriverEventsListener
{
void onError(long correlationId, ErrorCode errorCode, String message);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Receives commands from Aeron clients and dispatches them to the {@link DriverConductor} for processing.
*/
class DriverAdapter implements MessageHandler
class ClientRequestAdapter implements MessageHandler
{
/**
* Limit for the number of messages to be read in each receive.
Expand All @@ -49,7 +49,7 @@ class DriverAdapter implements MessageHandler
private final AtomicCounter errors;
private final DistinctErrorLog errorLog;

DriverAdapter(
ClientRequestAdapter(
final AtomicCounter errors,
final DistinctErrorLog errorLog,
final RingBuffer toDriverCommands,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class DriverConductor implements Agent
private final SenderProxy senderProxy;
private final ClientProxy clientProxy;
private final RingBuffer toDriverCommands;
private final DriverAdapter driverAdapter;
private final ClientRequestAdapter clientRequestAdapter;
private final ManyToOneConcurrentArrayQueue<DriverConductorCmd> driverCmdQueue;
private final HashMap<String, SendChannelEndpoint> sendChannelEndpointByChannelMap = new HashMap<>();
private final HashMap<String, ReceiveChannelEndpoint> receiveChannelEndpointByChannelMap = new HashMap<>();
Expand Down Expand Up @@ -108,7 +108,7 @@ public DriverConductor(final Context ctx)
countersManager = context.countersManager();
clientKeepAlives = context.systemCounters().get(CLIENT_KEEP_ALIVES);

driverAdapter = new DriverAdapter(
clientRequestAdapter = new ClientRequestAdapter(
context.systemCounters().get(ERRORS),
ctx.errorLog(),
toDriverCommands,
Expand Down Expand Up @@ -140,7 +140,7 @@ public int doWork() throws Exception
{
int workCount = 0;

workCount += driverAdapter.receive();
workCount += clientRequestAdapter.receive();
workCount += driverCmdQueue.drain(onDriverConductorCmdFunc, 10);

final long nowNs = nanoClock.nanoTime();
Expand Down

0 comments on commit 7d6412b

Please sign in to comment.