com.jtransc.async.JTranscAsyncTools Maven / Gradle / Ivy
package com.jtransc.async;
public class JTranscAsyncTools {
static public void runInThread(final JTranscAsyncHandler handler, final ThreadRun run) {
new Thread() {
@Override
public void run() {
final T result;
try {
result = run.run();
} catch (Throwable t) {
handler.complete(null, t);
return;
}
handler.complete(result, null);
}
}.start();
}
public interface ThreadRun {
T run() throws Throwable;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy