T
- the return type of the projection. It is equal to the journal event type
if the projection is null
or it is the identity projectionJ
- journal event typepublic abstract class EventJournalReadOperation<T,J> extends Operation implements IdentifiedDataSerializable, PartitionAwareOperation, BlockingOperation, ReadonlyOperation
null
in which case all elements are returned
and no projection is applied.Modifier and Type | Field and Description |
---|---|
protected int |
maxSize |
protected int |
minSize |
protected String |
name |
protected DistributedObjectNamespace |
namespace |
protected ReadResultSetImpl<J,T> |
resultSet |
protected long |
sequence |
protected long |
startSequence |
GENERIC_PARTITION_ID
Constructor and Description |
---|
EventJournalReadOperation() |
EventJournalReadOperation(String name,
long startSequence,
int minSize,
int maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
beforeRun()
The beforeRun is called before either the
Operation.run() or the Operation.call() method is called. |
protected abstract ReadResultSetImpl<J,T> |
createResultSet() |
protected abstract EventJournal<J> |
getJournal() |
Object |
getResponse()
Called if and only if
Operation.returnsResponse() returned true ,
shortly after Operation.run() returns. |
abstract String |
getServiceName() |
WaitNotifyKey |
getWaitKey() |
void |
onWaitExpire() |
protected void |
readInternal(ObjectDataInput in) |
void |
run()
Runs the operation.
|
boolean |
shouldWait()
On every invocation this method reads from the event journal until
it has collected the minimum required number of response items.
|
protected void |
writeInternal(ObjectDataOutput out) |
afterRun, 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, toString, validatesTarget, writeData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFactoryId, getId
readData, writeData
getPartitionId
getWaitTimeout
protected String name
protected int minSize
protected int maxSize
protected long startSequence
protected transient ReadResultSetImpl<J,T> resultSet
protected transient long sequence
protected transient DistributedObjectNamespace namespace
public EventJournalReadOperation()
public EventJournalReadOperation(String name, long startSequence, int minSize, int maxSize)
public void beforeRun()
Operation.run()
or the Operation.call()
method is called.
runs before wait-support
Checks the precondition that the start sequence is already
available (in the event journal) or is the sequence of the
next event to be added into the journal.public boolean shouldWait()
true
if there are currently not enough
elements in the response and the operation should be parked.shouldWait
in interface BlockingOperation
public void run() throws Exception
Operation
Operation.run()
or Operation.call()
method should be implemented; not both.
Runs after wait-support, supposed to do actual operationrun
in class Operation
Exception
Operation.call()
public Object getResponse()
Operation
Operation.returnsResponse()
returned true
,
shortly after Operation.run()
returns.getResponse
in class Operation
public WaitNotifyKey getWaitKey()
getWaitKey
in interface BlockingOperation
public void onWaitExpire()
onWaitExpire
in interface BlockingOperation
protected void writeInternal(ObjectDataOutput out) throws IOException
writeInternal
in class Operation
IOException
protected void readInternal(ObjectDataInput in) throws IOException
readInternal
in class Operation
IOException
public abstract String getServiceName()
getServiceName
in class Operation
protected abstract ReadResultSetImpl<J,T> createResultSet()
protected abstract EventJournal<J> getJournal()
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.