if (config.getThreadFactory() == null) {
config.setThreadFactory(getDefaultThreadFactory());
}
transactionTimeoutMillis = config.getTransactionTimeout(TimeUnit.MILLISECONDS);
final DelayedExecutor transactionMonitor = transactionTimeoutMillis > 0 ?
config.getTransactionMonitor() : null;
if (transactionMonitor != null) {
final DelayedExecutor.Worker<Worker> transactionWorker =
new DelayedExecutor.Worker<Worker>() {
@Override
public boolean doWork(final Worker worker) {
worker.t.interrupt();
delayedQueue.add(worker, NEVER_TIMEOUT, TimeUnit.MILLISECONDS);
return true;
}
};
delayedQueue = transactionMonitor.createDelayQueue(
transactionWorker, transactionResolver);
} else {
delayedQueue = null;
}
}