|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.continuent.tungsten.replicator.util.AtomicIntervalGuard<D>
public class AtomicIntervalGuard<D>
Tracks the sequence number and time interval between a group of tasks processing transactions to ensure that the first and last tasks do not get too far apart in the log. Class methods are fully synchronized, which results in a large number of lock requests. Changes to these classes should be carefully checked for performance via unit tests.
Since the initial implementation this class has been extended to add a datum that may optionally be stored with each thread. This allows clients to track additional hi/low properties for themselves.
| Constructor Summary | |
|---|---|
AtomicIntervalGuard(int expected)
Allocates a thread interval array. |
|
| Method Summary | |
|---|---|
D |
getHiDatum()
Return the datum of the highest entry in the array. |
long |
getHiLatency()
Return the latency in seconds between the commit time and the automatically generated commit time. |
long |
getHiSeqno()
Get highest seqno in the array. |
long |
getHiTime()
Return the highest time in the array. |
long |
getInterval()
Return the interval between highest and lowest values. |
D |
getLowDatum()
Return the datum of the lowest entry in the array. |
long |
getLowLatency()
Return lowest latency in milliseconds between the commit time and the automatically generated commit time in the array. |
long |
getLowSeqno()
Get lowest seqno in the array. |
long |
getLowTime()
Return the lowest time in the array. |
void |
report(int id,
long seqno,
long time)
Report position for an individual task without added datum. |
void |
report(int id,
long seqno,
long time,
D datum)
Report position for an individual task. |
void |
report(int id,
long seqno,
long time,
long reportTime,
D datum)
Report position for an individual task. |
int |
size()
Return the number of entries currently in the array. |
java.lang.String |
toString()
|
void |
unreport(int id)
Remove a particular task from the reported position array. |
void |
validate()
Ensures that the array is consistent by checking various safety conditions. |
long |
waitMinTime(long time,
long seqno)
Wait until the minimum time in array is greater than or equal to the request time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AtomicIntervalGuard(int expected)
expected - Expected number of threads for correct operation| Method Detail |
|---|
public void report(int id,
long seqno,
long time)
public void report(int id,
long seqno,
long time,
D datum)
id - Thread IDseqno - Sequence number reached by threadtime - Original timestamp of transactiondatum - An optional datum associated with the transaction
public void report(int id,
long seqno,
long time,
long reportTime,
D datum)
id - Thread IDseqno - Sequence number reached by threadtime - Original timestamp of transactionreportTime - Original time + latencydatum - An optional datum associated with the transaction
ReplicatorException - Thrown if there is an illegal update.public void unreport(int id)
id - Thread IDpublic int size()
public long getLowSeqno()
public long getLowTime()
public long getLowLatency()
public D getLowDatum()
public long getHiSeqno()
public long getHiTime()
public long getHiLatency()
public D getHiDatum()
public long getInterval()
public long waitMinTime(long time,
long seqno)
throws java.lang.InterruptedException
time - Return if this time is less than or equal to the trailing
commit timestampseqno - Return if this seqno is less than or equal to the trailing
seqno
java.lang.InterruptedExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
public void validate()
throws java.lang.RuntimeException
java.lang.RuntimeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||