Created
November 9, 2011 15:21
-
-
Save vblagoje/1351754 to your computer and use it in GitHub Desktop.
WithinThreadExecutor proposal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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