@@ -0,0 +1,2529 @@
+/*%0A * JBoss, Home of Professional Open Source%0A * Copyright 2007, Red Hat Middleware LLC, and individual contributors%0A * by the @authors tag. See the copyright.txt in the distribution for a%0A * full listing of individual contributors.%0A *%0A * This is free software; you can redistribute it and/or modify it%0A * under the terms of the GNU Lesser General Public License as%0A * published by the Free Software Foundation; either version 2.1 of%0A * the License, or (at your option) any later version.%0A *%0A * This software is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public%0A * License along with this software; if not, write to the Free%0A * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA%0A * 02110-1301 USA, or see the FSF site: http://www.fsf.org.%0A */%0Apackage org.jboss.test.util.test.concurrent;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0Aimport java.util.HashSet;%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0A%0Aimport org.jboss.util.threadpool.BasicTaskWrapper;%0Aimport org.jboss.util.threadpool.BasicThreadPool;%0Aimport org.jboss.util.threadpool.RunnableTaskWrapper;%0Aimport org.jboss.util.threadpool.Task;%0Aimport org.jboss.logging.Logger;%0Aimport junit.framework.TestCase;%0A%0A/**%0A * Tests of thread pool with Tasks added to the pool%0A *%0A * @see org.jboss.util.threadpool.ThreadPool%0A * @author %3Ca href=%22adrian@jboss.org%22%3EAdrian.Brock%3C/a%3E%0A * @author Scott.Stark@jboss.org%0A * @version $Revision: 2787 $%0A */%0Apublic class ThreadPoolInterruptedThreadUnitTestCase extends TestCase%0A%7B%0A   public ThreadPoolInterruptedThreadUnitTestCase(String name)%0A   %7B%0A      super(name);%0A   %7D%0A%0A   public static class TestRunnable implements Runnable%0A   %7B%0A      public CountDownLatch latch = new CountDownLatch(1);%0A      public void run()%0A      %7B%0A         latch.countDown();%0A      %7D%0A   %7D%0A   %0A   public void testInterruptedExecute() throws Exception%0A   %7B%0A      BasicThreadPool pool = new BasicThreadPool();%0A      TestRunnable runnable = new TestRunnable();%0A      %0A      Thread.currentThread().interrupt();%0A      try%0A      %7B%0A         pool.run(runnable);%0A      %7D%0A      finally%0A      %7B%0A         assertTrue(Thread.interrupted());%0A      %7D%0A      assertTrue(runnable.latch.await(10, TimeUnit.SECONDS));%0A   %7D%0A%7D%0A

Add a test for scheduling work when the thread is interrupted