|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.thl.THLParallelReadQueue
public class THLParallelReadQueue
Implements a queue that returns in total order the most recently read events from its parent read task and pending control events required to process watches properly. Items in this queue come from the following sources:
Access to this class is highly concurrent. Methods that merge queue contents are synchronized to ensure atomicity of changes across queue structures. Failure to do this could result in ordering violations. The event queue is protected by a concurrent collection. Methods that access this as well as statistical information are not synchronized, as doing so would raise the risk of deadlocks.
| Constructor Summary | |
|---|---|
THLParallelReadQueue(int taskId,
int maxSize,
int maxControlEvents,
long startingSeqno,
int syncInterval,
ReplDBMSHeader lastHeader,
AtomicIntervalGuard<?> intervalGuard)
Instantiates a new read queue. |
|
| Method Summary | |
|---|---|
void |
addWatchSyncPredicate(WatchPredicate<ReplDBMSHeader> predicate)
Add a new predicate to the list of predicates that should generate sync events. |
long |
getAcceptCount()
Return count of accepted events. |
long |
getDiscardCount()
Return count of discarded events. |
long |
getReadSeqno()
Returns current sequence number we have read. |
boolean |
isLastFrag()
Returns whether last event read was the end of a transaction. |
ReplEvent |
peek()
Returns but does not remove next event from the queue if it exists or returns null if queue is empty. |
void |
post(THLEvent thlEvent)
Post a normal event which will be enqueued immediately. |
void |
postOutOfBand(ReplControlEvent controlEvent)
Post a control event, which will either be immediately added to the event queue or buffered in the control event queue until it is time to merge it. |
void |
release()
Frees resources including all queues and lists. |
int |
size()
Returns the current queue size. |
ReplEvent |
take()
Removes the next event from the queue, waiting indefinitely for something to arrive. |
ReplEvent |
take(long timeout,
java.util.concurrent.TimeUnit unit)
Removes the next element from the event queue, returning null if it cannot be found within the timeout. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public THLParallelReadQueue(int taskId,
int maxSize,
int maxControlEvents,
long startingSeqno,
int syncInterval,
ReplDBMSHeader lastHeader,
AtomicIntervalGuard<?> intervalGuard)
taskId - Task to which this queue belongsmaxSize - Maximum number of all events to buffermaxControlEvents - Maximum number of control events to bufferstartingSeqno - Sequence number of next transactionsyncInterval - Interval at which to generate synchronization eventslastHeader - Header of last transaction processed before startintervalGuard - Interval guard to track read position| Method Detail |
|---|
public long getReadSeqno()
public boolean isLastFrag()
public long getAcceptCount()
public long getDiscardCount()
public void release()
public void addWatchSyncPredicate(WatchPredicate<ReplDBMSHeader> predicate)
throws java.lang.InterruptedException
predicate - Watch predicate
java.lang.InterruptedException
public void postOutOfBand(ReplControlEvent controlEvent)
throws java.lang.InterruptedException
controlEvent - Control event to post or buffer
java.lang.InterruptedException
public void post(THLEvent thlEvent)
throws java.lang.InterruptedException
thlEvent - Event to post.
java.lang.InterruptedExceptionpublic int size()
public ReplEvent take()
throws java.lang.InterruptedException
java.lang.InterruptedException - Thrown if thread is interrupted.
public ReplEvent take(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
timeout - Interval to waitunit - Unit of time
java.lang.InterruptedException - Thrown if thread is interrupted.
public ReplEvent peek()
throws java.lang.InterruptedException
java.lang.InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||