|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.storage.InMemoryTransactionalQueue
public class InMemoryTransactionalQueue
Implements an in-memory queue store that applies events from multiple task threads (i.e., channels) into a single centralized queue. The queue has transactional semantics in the sense that it buffers events from each task thread and them applies them in a single operation upon commit. This is helpful for detecting out-of-order apply due to errors in the synchronization of parallel tasks.
To further simulate DBMS behavior this queue supports commit actions, which may perform arbitrary actions such as delaying or throwing exceptions.
| Constructor Summary | |
|---|---|
InMemoryTransactionalQueue()
|
|
| Method Summary | |
|---|---|
void |
commit(int taskId)
Commits all pending events for a particular task. |
void |
configure(PluginContext context)
Complete plug-in configuration. |
ReplDBMSEvent |
get()
Removes and returns next event from the queue, blocking if empty. |
CommitAction |
getCommitAction()
An action to invoke prior to commit. |
int |
getCommitTimeout()
Maximum commit timeout (fails after this) in seconds. |
ReplDBMSHeader |
getLastHeader(int taskId)
Returns the last header processed. |
int |
getMaxSize()
Maximum number of events permitted in serial queue. |
long |
getMaxStoredSeqno()
Returns the maximum persistently stored sequence number. |
long |
getMinStoredSeqno()
Returns the minimum persistently stored sequence number. |
java.lang.String |
getName()
Gets the storage name. |
int |
getPartitions()
Number of partitions supported by the queue. |
ReplDBMSEvent |
peek()
Returns but does not remove next event from the queue if it exists or returns null if queue is empty. |
void |
prepare(PluginContext context)
Allocate an in-memory queue. |
void |
put(int taskId,
ReplDBMSEvent event)
Puts an event in the local task queue, where it is buffered in order until commit or rollback. |
void |
release(PluginContext context)
Release queue. |
void |
rollback(int taskId)
Rolls back pending events for a particular task. |
void |
setCommitAction(CommitAction commitAction)
|
void |
setCommitTimeout(int commitTimeout)
|
void |
setLastHeader(int taskId,
ReplDBMSHeader header)
Sets the last header processed. |
void |
setMaxSize(int size)
|
void |
setName(java.lang.String name)
Sets the storage name. |
void |
setPartitions(int partitions)
|
int |
size()
Returns the current serial queue size. |
TungstenProperties |
status()
Returns status information as a set of named properties. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InMemoryTransactionalQueue()
| Method Detail |
|---|
public java.lang.String getName()
getName in interface StoreStore.getName()public void setName(java.lang.String name)
setName in interface StoreStore.setName(java.lang.String)public int getMaxSize()
public void setMaxSize(int size)
public int getPartitions()
public void setPartitions(int partitions)
public int getCommitTimeout()
public void setCommitTimeout(int commitTimeout)
public CommitAction getCommitAction()
public void setCommitAction(CommitAction commitAction)
public void setLastHeader(int taskId,
ReplDBMSHeader header)
public ReplDBMSHeader getLastHeader(int taskId)
public long getMaxStoredSeqno()
getMaxStoredSeqno in interface StoreStore.getMaxStoredSeqno()public long getMinStoredSeqno()
getMinStoredSeqno in interface StoreStore.getMinStoredSeqno()
public void put(int taskId,
ReplDBMSEvent event)
throws java.lang.InterruptedException,
ReplicatorException
java.lang.InterruptedException
ReplicatorException
public void commit(int taskId)
throws java.lang.InterruptedException,
ReplicatorException
java.lang.InterruptedException
ReplicatorExceptionpublic void rollback(int taskId)
java.lang.InterruptedException
public ReplDBMSEvent get()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic ReplDBMSEvent peek()
public int size()
public void configure(PluginContext context)
throws ReplicatorException
configure in interface ReplicatorPluginReplicatorException - Thrown if configuration is incomplete or
failsReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)
public void prepare(PluginContext context)
throws ReplicatorException
prepare in interface ReplicatorPluginReplicatorException - Thrown if resource allocation failsReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)
public void release(PluginContext context)
throws ReplicatorException
release in interface ReplicatorPluginReplicatorException - Thrown if resource deallocation failsReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)public TungstenProperties status()
status in interface StoreStore.status()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||