/**
* Create the 2PC executor.
* @return the 2PC executor.
*/
public static Executor getExecutor() {
Executor executor = executorRef.get();
if (executor == null) {
if (getConfiguration().isAsynchronous2Pc()) {
if (log.isDebugEnabled()) { log.debug("using AsyncExecutor"); }
executor = new AsyncExecutor();
} else {
if (log.isDebugEnabled()) { log.debug("using SyncExecutor"); }
executor = new SyncExecutor();
}
if (!executorRef.compareAndSet(null, executor)) {
executor.shutdown();
executor = executorRef.get();
}
}
return executor;
}