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
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()
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.
|
protected abstract ReadResultSetImpl<J,T> |
createResultSet() |
protected abstract EventJournal<J> |
getJournal() |
Object |
getResponse() |
abstract String |
getServiceName() |
WaitNotifyKey |
getWaitKey() |
void |
logError(Throwable e)
Logs Exception/Error thrown during operation execution.
|
void |
onWaitExpire() |
protected void |
readInternal(ObjectDataInput in) |
void |
run() |
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, executedLocally, getCallerAddress, getCallerUuid, getCallId, getCallTimeout, getConnection, getInvocationTime, getLogger, getNodeEngine, getOperationResponseHandler, getPartitionId, getReplicaIndex, getService, getWaitTimeout, isUrgent, onExecutionFailure, onInvocationException, onSetCallId, readData, 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()
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 Object getResponse()
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 void logError(Throwable e)
Operation
public abstract String getServiceName()
getServiceName
in class Operation
protected abstract ReadResultSetImpl<J,T> createResultSet()
protected abstract EventJournal<J> getJournal()
Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.