package edu.umd.cs.findbugs; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.List; import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.TimeUnit; import javax.swing.SwingUtilities; public class AWTEventQueueExecutor extends AbstractExecutorService { public void shutdown() { } public List<Runnable> shutdownNow() { return Collections.emptyList(); } public boolean isShutdown() { return true; } public boolean isTerminated() { return true; } public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return true; } public void execute(Runnable command) { if (SwingUtilities.isEventDispatchThread()) { command.run(); return; } try { SwingUtilities.invokeAndWait(command); } catch (InterruptedException e) { throw new IllegalStateException(e); } catch (InvocationTargetException e) { throw new IllegalStateException(e); } } }