Package org.jboss.as.controller.remote
Class BlockingQueueOperationListener<T extends TransactionalProtocolClient.Operation>
java.lang.Object
org.jboss.as.controller.remote.BlockingQueueOperationListener<T>
- Type Parameters:
T- the operation type
- All Implemented Interfaces:
TransactionalProtocolClient.TransactionalOperationListener<T>
public class BlockingQueueOperationListener<T extends TransactionalProtocolClient.Operation>
extends Object
implements TransactionalProtocolClient.TransactionalOperationListener<T>
Basic operation listener backed by a blocking queue. If the limit of the queue is reached prepared operations
are going to be rolled back automatically.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionBlockingQueueOperationListener(int capacity) BlockingQueueOperationListener(BlockingQueue<TransactionalProtocolClient.PreparedOperation<T>> queue) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrainTo(Collection<TransactionalProtocolClient.PreparedOperation<T>> collection) voidoperationComplete(T operation, OperationResponse result) Notification that an operation completed.voidoperationFailed(T operation, org.jboss.dmr.ModelNode result) Notification that an operation failed.voidNotification that an operation was prepared.Retrieves and removes the head of the underlying queue, waiting if necessary until an element becomes available.retrievePreparedOperation(long timeout, TimeUnit timeUnit) Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
-
Constructor Details
-
BlockingQueueOperationListener
public BlockingQueueOperationListener() -
BlockingQueueOperationListener
public BlockingQueueOperationListener(int capacity) -
BlockingQueueOperationListener
public BlockingQueueOperationListener(BlockingQueue<TransactionalProtocolClient.PreparedOperation<T>> queue)
-
-
Method Details
-
operationPrepared
Description copied from interface:TransactionalProtocolClient.TransactionalOperationListenerNotification that an operation was prepared.- Specified by:
operationPreparedin interfaceTransactionalProtocolClient.TransactionalOperationListener<T extends TransactionalProtocolClient.Operation>- Parameters:
prepared- the prepared operation
-
operationFailed
Description copied from interface:TransactionalProtocolClient.TransactionalOperationListenerNotification that an operation failed.- Specified by:
operationFailedin interfaceTransactionalProtocolClient.TransactionalOperationListener<T extends TransactionalProtocolClient.Operation>- Parameters:
operation- the operationresult- the operation result
-
operationComplete
Description copied from interface:TransactionalProtocolClient.TransactionalOperationListenerNotification that an operation completed.- Specified by:
operationCompletein interfaceTransactionalProtocolClient.TransactionalOperationListener<T extends TransactionalProtocolClient.Operation>- Parameters:
operation- the operationresult- the final result
-
retrievePreparedOperation
public TransactionalProtocolClient.PreparedOperation<T> retrievePreparedOperation() throws InterruptedExceptionRetrieves and removes the head of the underlying queue, waiting if necessary until an element becomes available.- Returns:
- the prepared operation
- Throws:
InterruptedException
-
drainTo
-
retrievePreparedOperation
public TransactionalProtocolClient.PreparedOperation<T> retrievePreparedOperation(long timeout, TimeUnit timeUnit) throws InterruptedException Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.- Parameters:
timeout- the timeouttimeUnit- the time unit- Returns:
- the prepared operation
- Throws:
InterruptedException
-