com.cedarsoft.async.AsyncCallSupport2 Maven / Gradle / Ivy
The newest version!
package com.cedarsoft.async;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
*
*/
public class AsyncCallSupport2 {
@NotNull
private final ExecutorService executorService;
public AsyncCallSupport2() {
executorService = Executors.newFixedThreadPool( 1 );
}
@NotNull
public Future invoke( @NotNull Callable callable ) throws AsynchroniousInvocationException {
return executorService.submit( callable );
}
public void shutdown() {
executorService.shutdown();
}
public boolean isShutdown() {
return executorService.isShutdown();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy