use of com.arjuna.ats.internal.arjuna.coordinator.ReaperThread in project narayana by jbosstm.
the class TransactionReaper method instantiate.
/**
* Currently we let the reaper thread run at same priority as other threads.
* Could get priority from environment.
*/
public static synchronized void instantiate() {
if (TransactionReaper._theReaper == null) {
if (tsLogger.logger.isTraceEnabled()) {
tsLogger.logger.trace("TransactionReaper::instantiate()");
}
// default to dynamic mode
TransactionReaper._dynamic = true;
String mode = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperMode();
if (mode.compareTo(TransactionReaper.PERIODIC) == 0) {
TransactionReaper._dynamic = false;
}
if (mode.compareTo(TransactionReaper.NORMAL) == 0) {
TransactionReaper._dynamic = false;
tsLogger.i18NLogger.warn_coordinator_TransactionReaper_19();
}
long checkPeriod = Long.MAX_VALUE;
if (!TransactionReaper._dynamic) {
checkPeriod = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperTimeout();
}
TransactionReaper._theReaper = new TransactionReaper(checkPeriod);
TransactionReaper._theReaper._cancelWaitPeriod = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperCancelWaitPeriod();
if (TransactionReaper._theReaper._cancelWaitPeriod < 10) {
TransactionReaper._theReaper._cancelWaitPeriod = 10;
}
TransactionReaper._theReaper._cancelFailWaitPeriod = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperCancelFailWaitPeriod();
if (TransactionReaper._theReaper._cancelFailWaitPeriod < 10) {
TransactionReaper._theReaper._cancelFailWaitPeriod = 10;
}
TransactionReaper._theReaper._zombieMax = arjPropertyManager.getCoordinatorEnvironmentBean().getTxReaperZombieMax();
if (TransactionReaper._theReaper._zombieMax <= 0) {
TransactionReaper._theReaper._zombieMax = 1;
}
_reaperThread = new ReaperThread(TransactionReaper._theReaper);
// _reaperThread.setPriority(Thread.MIN_PRIORITY);
_reaperThread.setDaemon(true);
_reaperWorkerThread = new ReaperWorkerThread(TransactionReaper._theReaper);
_reaperWorkerThread.setDaemon(true);
_reaperThread.start();
_reaperWorkerThread.start();
}
}
Aggregations