package org.epics.archiverappliance.retrieval.workers;
import java.util.List;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.TimeUnit;
/**
* An ExecutorService that runs everything on the current thread.
* Used when the data generated by postprocessors is too large to fit in memory.
* @author mshankar
*
*/
public class CurrentThreadExecutorService extends AbstractExecutorService {
boolean shutdown = false;
@Override
public void shutdown() {
// Not much to do; we are not spawning other threads
shutdown = true;
}
@Override
public List<Runnable> shutdownNow() {
// Not much to do; we are not spawning other threads
shutdown = true;
return null;
}
@Override
public boolean isShutdown() {
return shutdown;
}
@Override
public boolean isTerminated() {
return shutdown;
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
return true;
}
@Override
public void execute(Runnable command) {
command.run();
}
}