implements Identifiable<ClientIdentifier> {
private static final Logger LOG = LoggerFactory.getLogger(ClientActorBehavior.class);
- protected ClientActorBehavior(final @Nonnull ClientActorContext context) {
+ protected ClientActorBehavior(@Nonnull final ClientActorContext context) {
super(context);
}
@Override
- public final @Nonnull ClientIdentifier getIdentifier() {
+ @Nonnull
+ public final ClientIdentifier getIdentifier() {
return context().getIdentifier();
}
}
// This method is executing in the actor context, hence we can safely interact with the queue
- private ClientActorBehavior doSendRequest(final long sequence, final TransactionRequest<?> request,
- final RequestCallback callback) {
+ private ClientActorBehavior doSendRequest(final TransactionRequest<?> request, final RequestCallback callback) {
// Get or allocate queue for the request
final SequencedQueue queue = context().queueFor(request.getTarget().getHistoryId().getCookie());
// Note this is a tri-state return and can be null
- final Optional<FiniteDuration> result = queue.enqueueRequest(sequence, request, callback);
+ final Optional<FiniteDuration> result = queue.enqueueRequest(request, callback);
if (result == null) {
// Happy path: we are done here
return this;
needBackend = queue.runTimeout();
} catch (NoProgressException e) {
// Uh-oh, no progress. The queue has already killed itself, now we need to remove it
+ LOG.debug("{}: No progress made - removing queue", persistenceId(), e);
context().removeQueue(queue);
return this;
}
}
/**
- * Halt And Catch Fire.
- *
- * Halt processing on this client. Implementations need to ensure they initiate state flush procedures. No attempt
- * to use this instance should be made after this method returns. Any such use may result in undefined behavior.
+ * Halt And Catch Fire. Halt processing on this client. Implementations need to ensure they initiate state flush
+ * procedures. No attempt to use this instance should be made after this method returns. Any such use may result
+ * in undefined behavior.
*
* @param cause Failure cause
*/
/**
* Override this method to handle any command which is not handled by the base behavior.
*
- * @param command
+ * @param command the command to process
* @return Next behavior to use, null if this actor should shut down.
*/
- protected abstract @Nullable ClientActorBehavior onCommand(@Nonnull Object command);
+ @Nullable
+ protected abstract ClientActorBehavior onCommand(@Nonnull Object command);
/**
* Override this method to provide a backend resolver instance.
*
- * @return
+ * @return a backend resolver instance
*/
- protected abstract @Nonnull BackendInfoResolver<?> resolver();
+ @Nonnull
+ protected abstract BackendInfoResolver<?> resolver();
/**
* Send a request to the backend and invoke a specified callback when it finishes. This method is safe to invoke
* @param request Request to send
* @param callback Callback to invoke
*/
- public final void sendRequest(final long sequence, final TransactionRequest<?> request, final RequestCallback callback) {
- context().executeInActor(cb -> cb.doSendRequest(sequence, request, callback));
+ public final void sendRequest(final TransactionRequest<?> request, final RequestCallback callback) {
+ context().executeInActor(cb -> cb.doSendRequest(request, callback));
}
}