bitronix.tm.twopc.executor.SimpleAsyncExecutor Maven / Gradle / Ivy
package bitronix.tm.twopc.executor;
import bitronix.tm.internal.BitronixRuntimeException;
/**
* This implementation spawns a new thread per request.
*
*
* @author lorban
*/
public class SimpleAsyncExecutor implements Executor {
public Object submit(Job job) {
Thread t = new Thread(job);
t.setDaemon(true);
t.start();
return t;
}
public void waitFor(Object future, long timeout) {
Thread t = (Thread) future;
try {
t.join(timeout);
} catch (InterruptedException ex) {
throw new BitronixRuntimeException("job interrupted", ex);
}
}
public boolean isDone(Object future) {
Thread t = (Thread) future;
return !t.isAlive();
}
public boolean isUsable() {
return true;
}
public void shutdown() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy