PosixJNAAffinity.INSTANCE.setAffinity(m_coreBindIds);
}
initialize();
m_startupConfig = null; // release the serializableCatalog.
//Maintain a minimum ratio of task log (unrestricted) to live (restricted) transactions
final MinimumRatioMaintainer mrm = new MinimumRatioMaintainer(m_taskLogReplayRatio);
try {
while (m_shouldContinue) {
if (m_rejoinState == kStateRunning) {
// Normal operation blocks the site thread on the sitetasker queue.
SiteTasker task = m_scheduler.take();
if (task instanceof TransactionTask) {
m_currentTxnId = ((TransactionTask)task).getTxnId();
m_lastTxnTime = EstTime.currentTimeMillis();
}
task.run(getSiteProcedureConnection());
} else if (m_rejoinState == kStateReplayingRejoin) {
// Rejoin operation poll and try to do some catchup work. Tasks
// are responsible for logging any rejoin work they might have.
SiteTasker task = m_scheduler.poll();
boolean didWork = false;
if (task != null) {
didWork = true;
//If the task log is empty, free to execute the task
//If the mrm says we can do a restricted task, go do it
//Otherwise spin doing unrestricted tasks until we can bail out
//and do the restricted task that was polled
while (!m_rejoinTaskLog.isEmpty() && !mrm.canDoRestricted()) {
replayFromTaskLog(mrm);
}
mrm.didRestricted();
if (m_rejoinState == kStateRunning) {
task.run(getSiteProcedureConnection());
} else {
task.runForRejoin(getSiteProcedureConnection(), m_rejoinTaskLog);
}