* @param executor the executor or null if one is not created yet
*/
public static void stopExecutor(Executor executor) throws InterruptedException, JMSException {
if (executor instanceof Service) {
Service service = (Service) executor;
service.stop();
}
else if (executor instanceof PooledExecutor) {
PooledExecutor pe = (PooledExecutor) executor;
pe.shutdownAfterProcessingCurrentlyQueuedTasks();
//pe.shutdownNow();