Skip to content

Instantly share code, notes, and snippets.

@vblagoje
Created November 9, 2011 15:21
Show Gist options
  • Save vblagoje/1351754 to your computer and use it in GitHub Desktop.
Save vblagoje/1351754 to your computer and use it in GitHub Desktop.
WithinThreadExecutor proposal
public final class WithinThreadExecutor extends AbstractExecutorService {
private volatile boolean shutDown = false;
public void execute(Runnable command) {
command.run();
}
public void shutdown() {
shutDown = true;
}
public List<Runnable> shutdownNow() {
shutDown = true;
return Collections.emptyList();
}
public boolean isShutdown() {
return shutDown;
}
public boolean isTerminated() {
return shutDown;
}
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
return shutDown;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment