|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.spi.RepairExecutor
public class RepairExecutor
A convenience class for repositories to run dynamic repairs in separate threads. When a repository detects a consistency error during a user operation, it should not perform the repair in the same thread.
If the repair was initiated by an exception, but the original exception is re-thrown, a transaction exit will rollback the repair! Executing the repair in a separate thread allows it to wait until the transaction has exited.
Other kinds of inconsistencies might be detected during cursor iteration. The repair will need to acquire write locks, but the open cursor might not allow that, resulting in deadlock. Executing the repair in a separate thread allows it to wait until the cursor has released locks.
This class keeps thread-local references to single-threaded executors. In other words, each user thread has at most one associated repair thread. Each repair thread has a fixed size queue, and they exit when they are idle. If the queue is full, newly added repair tasks are silently discarded.
The following system properties are supported:
| Method Summary | |
|---|---|
static void |
execute(Runnable repair)
|
static boolean |
waitForRepairsToFinish(long timeoutMillis)
Waits for repairs that were executed from the current thread to finish. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void execute(Runnable repair)
public static boolean waitForRepairsToFinish(long timeoutMillis)
throws InterruptedException
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||