public class TxnReserveOfferOperation extends QueueBackupAwareOperation implements BlockingOperation, MutatingOperation
Checks if the queue can accomodate one more item in addition to the number provided to the constructor and returns the next item ID. This check is done on a scope of one transaction and does not include other transactions. It can also happen that after this check succeeds, the user will add more items to the queue which means that the queue can no longer accomodate for the items for which it has returned an item ID.
The operation can also wait until there is enough room or the wait timeout has elapsed.
responsenameGENERIC_PARTITION_ID| Constructor and Description |
|---|
TxnReserveOfferOperation() |
TxnReserveOfferOperation(String name,
long timeoutMillis,
int txSize,
String transactionId) |
| Modifier and Type | Method and Description |
|---|---|
Operation |
getBackupOperation()
Creates the
BackupOperation responsible for making the backup. |
int |
getId()
Returns type identifier for this class.
|
WaitNotifyKey |
getWaitKey() |
void |
onWaitExpire() |
protected void |
readInternal(ObjectDataInput in) |
void |
run()
Runs the operation.
|
boolean |
shouldBackup()
Checks if a backup needs to be made.
|
boolean |
shouldWait() |
protected void |
writeInternal(ObjectDataOutput out) |
getAsyncBackupCount, getSyncBackupCountafterRun, beforeRun, getContainer, getFactoryId, getQueueService, getResponse, getServiceName, hasListener, publishEventgetName, toStringcall, executedLocally, getCallerAddress, getCallerUuid, getCallId, getCallTimeout, getConnection, getInvocationTime, getLogger, getNodeEngine, getOperationResponseHandler, getPartitionId, getReplicaIndex, getService, getWaitTimeout, isUrgent, logError, onExecutionFailure, onInvocationException, onSetCallId, readData, requiresExplicitServiceName, returnsResponse, sendResponse, setCallerUuid, setNodeEngine, setOperationResponseHandler, setPartitionId, setReplicaIndex, setService, setServiceName, setValidateTarget, setWaitTimeout, toString, validatesTarget, writeDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetWaitTimeoutgetPartitionIdreadData, writeDatagetNamepublic void run()
throws Exception
Operation.run() or Operation.call() method should be implemented; not both.
Runs after wait-support, supposed to do actual operation
Sets the response to the next item ID if the queue can
accomodate txSize + 1 items.run in class OperationExceptionOperation.call()public WaitNotifyKey getWaitKey()
getWaitKey in interface BlockingOperationpublic boolean shouldWait()
shouldWait in interface BlockingOperationpublic void onWaitExpire()
onWaitExpire in interface BlockingOperationpublic boolean shouldBackup()
BackupAwareOperationshouldBackup in interface BackupAwareOperationpublic Operation getBackupOperation()
BackupAwareOperationBackupOperation responsible for making the backup.getBackupOperation in interface BackupAwareOperationBackupOperation responsible for making the backup.public int getId()
IdentifiedDataSerializablegetId in interface IdentifiedDataSerializableprotected void writeInternal(ObjectDataOutput out) throws IOException
writeInternal in class AbstractNamedOperationIOExceptionprotected void readInternal(ObjectDataInput in) throws IOException
readInternal in class AbstractNamedOperationIOExceptionCopyright © 2020 Hazelcast, Inc.. All Rights Reserved.