@@ -0,0 +1,3333 @@
+/*%0A * Copyright (C) 2013 Herve Quiroz%0A *%0A * This library is free software; you can redistribute it and/or modify it under%0A * the terms of the GNU Lesser General Public License as published by the Free%0A * Software Foundation; either version 2.1 of the License, or (at your option)%0A * any later version.%0A * %0A * This library is distributed in the hope that it will be useful, but WITHOUT%0A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS%0A * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more%0A * details.%0A * %0A * You should have received a copy of the GNU Lesser General Public License%0A * along with this library; if not, write to the Free Software Foundation, Inc.,%0A * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA %0A */%0Apackage org.trancecode.concurrent;%0A%0Aimport java.util.List;%0Aimport java.util.concurrent.AbstractExecutorService;%0Aimport java.util.concurrent.Callable;%0Aimport java.util.concurrent.Executor;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Future;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.atomic.AtomicLong;%0A%0A/**%0A * Utility methods related to %7B@link Executor%7D and %7B@link ExecutorService%7D.%0A * %0A * @author Herve Quiroz%0A */%0Apublic final class TcExecutors%0A%7B%0A    private static final ExecutorService EXECUTOR = newSingleUseThreadExecutorService();%0A%0A    private TcExecutors()%0A    %7B%0A        // No instantiation%0A    %7D%0A%0A    public static ExecutorService newSingleUseThreadExecutorService()%0A    %7B%0A        return newSingleUseThreadExecutorService(TcExecutors.class.getName());%0A    %7D%0A%0A    public static ExecutorService newSingleUseThreadExecutorService(final String threadNamePrefix)%0A    %7B%0A        return new AbstractExecutorService()%0A        %7B%0A            private final AtomicLong numberOfThreads = new AtomicLong(0);%0A%0A            @Override%0A            public void shutdown()%0A            %7B%0A                // TODO .shutdown()%0A                throw new UnsupportedOperationException();%0A            %7D%0A%0A            @Override%0A            public List%3CRunnable%3E shutdownNow()%0A            %7B%0A                // TODO .shutdownNow()%0A                throw new UnsupportedOperationException();%0A            %7D%0A%0A            @Override%0A            public boolean isShutdown()%0A            %7B%0A                // TODO .isShutdown()%0A                throw new UnsupportedOperationException();%0A            %7D%0A%0A            @Override%0A            public boolean isTerminated()%0A            %7B%0A                // TODO .isTerminated()%0A                throw new UnsupportedOperationException();%0A            %7D%0A%0A            @Override%0A            public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException%0A            %7B%0A                // TODO .awaitTermination()%0A                throw new UnsupportedOperationException();%0A            %7D%0A%0A            @Override%0A            public void execute(final Runnable command)%0A            %7B%0A                final Thread thread = new Thread(command);%0A                thread.setName(threadNamePrefix + numberOfThreads.incrementAndGet());%0A                thread.setDaemon(true);%0A                thread.start();%0A            %7D%0A        %7D;%0A    %7D%0A%0A    public static %3CT%3E Future%3CT%3E concurrentExecute(final Callable%3CT%3E command)%0A    %7B%0A        return EXECUTOR.submit(command);%0A    %7D%0A%7D%0A

Add TcExecutors.concurrentExecute()