xapi.process.X_Process Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xapi-dev Show documentation
Show all versions of xapi-dev Show documentation
Everything needed to run a comprehensive dev environment.
Just type X_ and pick a service from autocomplete;
new dev modules will be added as they are built.
The only dev service not included in the uber jar is xapi-dev-maven,
as it includes all runtime dependencies of maven, adding ~4 seconds to build time,
and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).
The newest version!
package xapi.process;
import java.util.concurrent.Future;
import javax.inject.Provider;
import xapi.inject.X_Inject;
import xapi.process.api.AsyncLock;
import xapi.process.api.Process;
import xapi.process.api.ProcessController;
import xapi.process.service.ConcurrencyService;
import xapi.util.api.ReceivesValue;
public class X_Process {
private static final Provider service = X_Inject
.singletonLazy(ConcurrencyService.class);
public static void block(Future future, ReceivesValue receiver) {
service.get().resolve(future, receiver);
}
public static void runDeferred(Runnable cmd) {
service.get().runDeferred(cmd);
}
public static void runEventually(Runnable cmd) {
service.get().runEventually(cmd);
}
public static void runFinally(Runnable cmd) {
service.get().runFinally(cmd);
}
public static void runTimeout(Runnable cmd, int milliDelay) {
service.get().runTimeout(cmd, milliDelay);
}
public static Thread newThread(Runnable cmd) {
return service.get().newThread(cmd);
}
public static ProcessController newProcess(Process process) {
return service.get().newProcess(process);
}
public static boolean flush(int timeout) {
return flush(Thread.currentThread(), timeout);
}
public static boolean flush(Thread thread, int timeout) {
return service.get().flush(thread, timeout);
}
public static boolean trySleep(int millis) {
return service.get().trySleep(millis);
}
public static void kill(Thread thread, int timeout) {
service.get().kill(thread, timeout);
}
public static double threadStartTime() {
return service.get().threadStartTime(Thread.currentThread());
}
public static double now() {
return service.get().now();
}
public static AsyncLock newLock() {
return service.get().newLock();
}
}