Interface OutboundQueue
-
- All Known Subinterfaces:
OutboundQueueProvider
- All Known Implementing Classes:
OutboundQueueProviderImpl
,StackedOutboundQueueNoBarrier
@Beta public interface OutboundQueue
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
commitEntry(@NonNull Long xid, @Nullable OfHeader message, @Nullable com.google.common.util.concurrent.FutureCallback<OfHeader> callback)
Commit the specified offset using a message.void
commitEntry(@NonNull Long xid, @Nullable OfHeader message, @Nullable com.google.common.util.concurrent.FutureCallback<OfHeader> callback, @Nullable Function<OfHeader,Boolean> isComplete)
Commit the specified offset using a message.Long
reserveEntry()
Reserve an entry in the outbound queue.
-
-
-
Method Detail
-
reserveEntry
Long reserveEntry()
Reserve an entry in the outbound queue.- Returns:
- XID for the new message, or null if the queue is full
-
commitEntry
void commitEntry(@NonNull Long xid, @Nullable OfHeader message, @Nullable com.google.common.util.concurrent.FutureCallback<OfHeader> callback)
Commit the specified offset using a message. Specified callback will be invoked once we know how it has resolved, either with a normal response, implied completion via a barrier, or failure (such as connection drop). For multipart responses,FutureCallback.onSuccess(Object)
will be invoked multiple times as the corresponding responses arrive. If the request is completed with a response, the object reported will be non-null. If the request's completion is implied by a barrier, the object reported will be null.If this request fails on the remote device,
FutureCallback.onFailure(Throwable)
will be called with an instance ofDeviceRequestFailedException
.If the request fails due to local reasons,
FutureCallback.onFailure(Throwable)
will be called with an instance ofOutboundQueueException
. In particular, if this request failed because the device disconnected,OutboundQueueException.DEVICE_DISCONNECTED
will be reported.- Parameters:
xid
- Previously-reserved XIDmessage
- Message which should be sent out, or null if the reservation should be cancelled.callback
- Callback to be invoked, or null if no callback should be invoked.- Throws:
IllegalArgumentException
- if the slot is already committed or was never reserved.
-
commitEntry
void commitEntry(@NonNull Long xid, @Nullable OfHeader message, @Nullable com.google.common.util.concurrent.FutureCallback<OfHeader> callback, @Nullable Function<OfHeader,Boolean> isComplete)
Commit the specified offset using a message. Specified callback will be invoked once we know how it has resolved, either with a normal response, implied completion via a barrier, or failure (such as connection drop). For multipart responses,FutureCallback.onSuccess(Object)
will be invoked multiple times as the corresponding responses arrive. If the request is completed with a response, the object reported will be non-null. If the request's completion is implied by a barrier, the object reported will be null.If this request fails on the remote device,
FutureCallback.onFailure(Throwable)
will be called with an instance ofDeviceRequestFailedException
.If the request fails due to local reasons,
FutureCallback.onFailure(Throwable)
will be called with an instance ofOutboundQueueException
. In particular, if this request failed because the device disconnected,OutboundQueueException.DEVICE_DISCONNECTED
will be reported.- Parameters:
xid
- Previously-reserved XIDmessage
- Message which should be sent out, or null if the reservation should be cancelled.callback
- Callback to be invoked, or null if no callback should be invoked.isComplete
- Function to determine if OfHeader is processing is complete- Throws:
IllegalArgumentException
- if the slot is already committed or was never reserved.
-
-