Merge branch 'JABAWS_Release_2_0'
[jabaws.git] / engine / compbio / engine / local / _TrackingExecutor.java
diff --git a/engine/compbio/engine/local/_TrackingExecutor.java b/engine/compbio/engine/local/_TrackingExecutor.java
deleted file mode 100644 (file)
index ac0f848..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/* Copyright (c) 2009 Peter Troshin\r
- *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
- * \r
- *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
- *  Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- *  License for more details.\r
- * \r
- *  A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-package compbio.engine.local;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashSet;\r
-import java.util.List;\r
-import java.util.Set;\r
-import java.util.concurrent.AbstractExecutorService;\r
-import java.util.concurrent.Callable;\r
-import java.util.concurrent.ExecutorService;\r
-import java.util.concurrent.Future;\r
-import java.util.concurrent.TimeUnit;\r
-\r
-/**\r
- * This executor extends standard Java ExecutorService by adding the method to\r
- * obtain all Runnables which were running and did not complete upon executor\r
- * termination. For this to work properly Runnables must propagate an\r
- * Interruption exceptions, not swallow them, which a good Runnable should do\r
- * anyway.\r
- * \r
- * TODO it may be better to persists task from different place\r
- * \r
- * @author pvtroshin\r
- * @version 1.0 October 2009\r
- * @deprecated\r
- */\r
-@Deprecated\r
-class _TrackingExecutor extends AbstractExecutorService {\r
-\r
-       private final ExecutorService executor;\r
-\r
-       public _TrackingExecutor(ExecutorService executor) {\r
-               this.executor = executor;\r
-       }\r
-\r
-       private final Set<Runnable> cancelledRunnableTasksAtShutdown = new HashSet<Runnable>();\r
-       private final Set<Callable<?>> cancelledCallableTasksAtShutdown = new HashSet<Callable<?>>();\r
-\r
-       public List getCancelledTasks() {\r
-               if (!executor.isTerminated()) {\r
-                       throw new IllegalStateException(\r
-                                       "Executor must be terminated before running this method!");\r
-               }\r
-               ArrayList tasks = new ArrayList(cancelledCallableTasksAtShutdown);\r
-               tasks.addAll(cancelledRunnableTasksAtShutdown);\r
-               return tasks;\r
-       }\r
-\r
-       @Override\r
-       public void execute(final Runnable runnable) {\r
-               executor.execute(new Runnable() {\r
-                       @Override\r
-                       public void run() {\r
-                               try {\r
-                                       runnable.run();\r
-                               } finally {\r
-                                       if (isShutdown() && Thread.currentThread().isInterrupted()) {\r
-                                               cancelledRunnableTasksAtShutdown.add(runnable);\r
-                                       }\r
-                               }\r
-                       }\r
-               });\r
-       }\r
-\r
-       @Override\r
-       public <T> Future<T> submit(final Callable<T> task) {\r
-               return executor.submit(new Callable<T>() {\r
-                       @Override\r
-                       public T call() throws Exception {\r
-                               try {\r
-                                       return task.call();\r
-                               } finally {\r
-                                       if (isShutdown() && Thread.currentThread().isInterrupted()) {\r
-                                               cancelledCallableTasksAtShutdown.add(task);\r
-                                       }\r
-                               }\r
-                       }\r
-               });\r
-       }\r
-\r
-       @Override\r
-       public boolean awaitTermination(long timeout, TimeUnit unit)\r
-                       throws InterruptedException {\r
-               return executor.awaitTermination(timeout, unit);\r
-       }\r
-\r
-       @Override\r
-       public boolean isShutdown() {\r
-               return executor.isShutdown();\r
-       }\r
-\r
-       @Override\r
-       public boolean isTerminated() {\r
-               return executor.isTerminated();\r
-       }\r
-\r
-       @Override\r
-       public void shutdown() {\r
-               executor.shutdown();\r
-       }\r
-\r
-       @Override\r
-       public List<Runnable> shutdownNow() {\r
-               return executor.shutdownNow();\r
-       }\r
-\r
-}\r