|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jts.utils.RecoveryHooks.FailureInducer
public class FailureInducer
This class defines API's for the test harness to induce recovery by setting crash points (in the case of TM crashes) and wait points (in the case of RM crashes). In order to induce TM crashes, the test harness sets the failure points by calling setCrashPoint(), after transaction.begin() from each thread. Thus, multiple threads involving different transactions can set different points of failure, which will cause the TM to wait at the failure points, until crash() method is invoked. Note: Only those transactions calling setCrashPoint() will be affected. The crash() method needs to be invoked from a seperate thread. The TM would increment TestRecovery.waitCount field to indicate the total number of failure points reached. When the waitCount reaches the expected value (obtained through getWaitCount()), the test harness shall call crash(). In order to test RM recovery, the test harness sets the failure points by calling setWaitPoint(), after transaction.begin() from each thread. The TM waits at predefined failure points for the stipulated time duration, during which the RM is expected to crash; after which the TM will proceed with regular completion (a human is expected to crash the RM manually during the wait duration). As in the TM recovery case, the waitCount will be incremented to indicate the total number of failure points reached. If the RM does not crash during the stipulated time duration, the TM will proceed with normal completion for the specific transaction. It does not matter if the RM comes back alive, since the TM would anyway retry completion. Note: Only those transactions calling setWaitPoint() will be affected.
| Field Summary | |
|---|---|
static java.lang.Integer |
ACTIVE
|
static java.lang.Integer |
COMPLETED
|
static java.lang.Integer |
COMPLETING
|
static java.lang.Integer |
PREPARED
|
static java.lang.Integer |
PREPARING
|
| Constructor Summary | |
|---|---|
FailureInducer()
|
|
| Method Summary | |
|---|---|
static void |
activateFailureInducer()
This activates the FailureInducer. |
static void |
crash()
Forces the TM to crash. |
static void |
deactivateFailureInducer()
This deactivates the FailureInducer. |
static int |
getWaitCount()
|
static boolean |
isFailureInducerActive()
|
static void |
setCrashPoint(java.lang.Integer crashPoint)
Setting a crash point will cause the TM to wait at the failure point, until crash() is called. |
static void |
setWaitPoint(java.lang.Integer waitPoint,
int waitDuration)
Setting a wait point will cause the TM to wait at the failure point, for the stipulated wait duration. |
static void |
setWaitPointRecovery(int waitDuration)
Enable wait action dyring delegated recovery via "add-wait-point-during-recovery" property added to the transaction-service config |
static void |
waitForFailure(GlobalTID gtid,
java.lang.Integer failPoint)
This method is called by the coordinator at every valid failure point. |
static void |
waitInRecovery()
Perform wait action dyring delegated recovery |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.Integer ACTIVE
public static final java.lang.Integer PREPARING
public static final java.lang.Integer PREPARED
public static final java.lang.Integer COMPLETING
public static final java.lang.Integer COMPLETED
| Constructor Detail |
|---|
public FailureInducer()
| Method Detail |
|---|
public static void activateFailureInducer()
public static void deactivateFailureInducer()
public static boolean isFailureInducerActive()
public static void setCrashPoint(java.lang.Integer crashPoint)
crashPoint - pre-defined failure points
(PREPARING, PREPARED, COMMITTING, COMMITTED).
public static void setWaitPoint(java.lang.Integer waitPoint,
int waitDuration)
crashPoint - pre-defined failure points
(PREPARING, PREPARED, COMMITTING, COMMITTED).waitDuration - time duration (seconds) for RM failure to happen.public static void crash()
public static int getWaitCount()
public static void waitForFailure(GlobalTID gtid,
java.lang.Integer failPoint)
coord - the coordinator object (which represents the transaction.failPoint - indicates the current failure point in coordinator code.public static void setWaitPointRecovery(int waitDuration)
public static void waitInRecovery()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||