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.
response
name
GENERIC_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, getSyncBackupCount
afterRun, beforeRun, getContainer, getFactoryId, getQueueService, getResponse, getServiceName, hasListener, publishEvent
getName, toString
call, 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, writeData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getWaitTimeout
getPartitionId
readData, writeData
getName
public 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 Operation
Exception
Operation.call()
public WaitNotifyKey getWaitKey()
getWaitKey
in interface BlockingOperation
public boolean shouldWait()
shouldWait
in interface BlockingOperation
public void onWaitExpire()
onWaitExpire
in interface BlockingOperation
public boolean shouldBackup()
BackupAwareOperation
shouldBackup
in interface BackupAwareOperation
public Operation getBackupOperation()
BackupAwareOperation
BackupOperation
responsible for making the backup.getBackupOperation
in interface BackupAwareOperation
BackupOperation
responsible for making the backup.public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
protected void writeInternal(ObjectDataOutput out) throws IOException
writeInternal
in class AbstractNamedOperation
IOException
protected void readInternal(ObjectDataInput in) throws IOException
readInternal
in class AbstractNamedOperation
IOException
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.