Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java3
-rw-r--r--plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java3
-rw-r--r--plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml1
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java20
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java28
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java20
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/PassThroughCallable.java29
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java59
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java48
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java10
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java52
-rw-r--r--plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorWorkCache.java95
13 files changed, 35 insertions, 335 deletions
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
index 64ff08fbda7..65fa662f183 100644
--- a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutionCallbackTest.java
@@ -19,7 +19,6 @@ import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import org.eclipse.osee.event.EventService;
import org.eclipse.osee.executor.admin.CancellableCallable;
import org.eclipse.osee.executor.admin.ExecutionCallback;
import org.eclipse.osee.logger.Log;
@@ -42,7 +41,6 @@ public class ExecutionCallbackTest {
//@formatter:off
@Mock private Log logger;
- @Mock private EventService eventService;
@Mock private Callable<String> callable;
@Mock private ExecutionCallback<String> callback;
//@formatter:on
@@ -55,7 +53,6 @@ public class ExecutionCallbackTest {
admin = new ExecutorAdminImpl();
admin.setLogger(logger);
- admin.setEventService(eventService);
admin.start(new HashMap<String, Object>());
}
diff --git a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java
index 28120350da0..eb1d1ccaae5 100644
--- a/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java
+++ b/plugins/org.eclipse.osee.executor.admin.test/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminTest.java
@@ -12,7 +12,6 @@ package org.eclipse.osee.executor.admin.internal;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
-import org.eclipse.osee.event.EventService;
import org.eclipse.osee.logger.Log;
import org.junit.After;
import org.junit.Assert;
@@ -28,7 +27,6 @@ public class ExecutorAdminTest {
//@formatter:off
@Mock private Log logger;
- @Mock private EventService eventService;
//@formatter:on
private ExecutorAdminImpl admin;
@@ -39,7 +37,6 @@ public class ExecutorAdminTest {
admin = new ExecutorAdminImpl();
admin.setLogger(logger);
- admin.setEventService(eventService);
admin.start(new HashMap<String, Object>());
}
diff --git a/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF
index cdd0ba968a7..f9f914344c2 100644
--- a/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.executor.admin/META-INF/MANIFEST.MF
@@ -8,7 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.executor.admin
Import-Package: com.google.common.collect;version="[11.0.0,15.0.0)",
com.google.common.util.concurrent;version="[11.0.0,15.0.0)",
- org.eclipse.osee.event,
+ org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.logger
Service-Component: OSGI-INF/*.xml
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml b/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml
index 5cc9bba98be..1dde391207d 100644
--- a/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml
+++ b/plugins/org.eclipse.osee.executor.admin/OSGI-INF/executor.admin.impl.xml
@@ -5,5 +5,4 @@
<provide interface="org.eclipse.osee.executor.admin.ExecutorAdmin"/>
</service>
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
- <reference bind="setEventService" cardinality="1..1" interface="org.eclipse.osee.event.EventService" name="EventService" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java
index bbbadddf80d..2b651ef7ac4 100644
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorAdmin.java
@@ -18,24 +18,18 @@ import java.util.concurrent.Future;
*/
public interface ExecutorAdmin {
- // ExecutorService getDefaultExecutor() throws Exception;
- //
- // ExecutorService getExecutor(String name) throws Exception;
- //
- // <T> Callable<T> addCallback(Callable<T> callable, ExecutionCallback<T> callback);
+ void createFixedPoolExecutor(String id, int poolSize);
- void createFixedPoolExecutor(String id, int poolSize) throws Exception;
+ void createCachedPoolExecutor(String id);
- void createCachedPoolExecutor(String id) throws Exception;
+ <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback);
- <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback) throws Exception;
+ <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback);
- <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback) throws Exception;
+ <T> Future<T> schedule(Callable<T> callable);
- <T> Future<T> schedule(Callable<T> callable) throws Exception;
+ <T> Future<T> schedule(String id, Callable<T> callable);
- <T> Future<T> schedule(String id, Callable<T> callable) throws Exception;
-
- void shutdown(String id) throws Exception;
+ void shutdown(String id);
}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java
deleted file mode 100644
index e2cbf4ce8e0..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/ExecutorConstants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin;
-
-/**
- * @author Roberto E. Escobar
- */
-public final class ExecutorConstants {
-
- private ExecutorConstants() {
- // Constants Class
- }
-
- private static final String PREFIX = "org/eclipse/osee/executor/admin/";
-
- public static final String EXECUTOR_ADMIN_REGISTRATION_EVENT = PREFIX + "EXECUTOR_ADMIN_REGISTRATION";
-
- public static final String EXECUTOR_ADMIN_DEREGISTRATION_EVENT = PREFIX + "EXECUTOR_ADMIN_DEREGISTRATION";
-
-}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java
deleted file mode 100644
index 89fcb63eac2..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/HasExecutionCallback.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin;
-
-/**
- * @author Roberto E. Escobar
- */
-public interface HasExecutionCallback<T> {
-
- ExecutionCallback<T> getExecutionCallback();
-
-}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/PassThroughCallable.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/PassThroughCallable.java
deleted file mode 100644
index f7452c10710..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/PassThroughCallable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin;
-
-/**
- * @author Roberto E. Escobar
- */
-public class PassThroughCallable<T> extends CancellableCallable<T> {
-
- private final T results;
-
- public PassThroughCallable(T results) {
- this.results = results;
- }
-
- @Override
- public T call() throws Exception {
- checkForCancelled();
- return results;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java
deleted file mode 100644
index c44a0759ea0..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/CallableWithCallbackImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin.internal;
-
-import java.util.concurrent.Callable;
-import org.eclipse.osee.executor.admin.CancellableCallable;
-import org.eclipse.osee.executor.admin.ExecutionCallback;
-import org.eclipse.osee.executor.admin.HasCancellation;
-import org.eclipse.osee.executor.admin.HasExecutionCallback;
-
-/**
- * @author Roberto E. Escobar
- */
-public class CallableWithCallbackImpl<T> extends CancellableCallable<T> implements HasExecutionCallback<T> {
-
- private final Callable<T> innerWorker;
- private final ExecutionCallback<T> callback;
-
- public CallableWithCallbackImpl(Callable<T> innerWorker, ExecutionCallback<T> callback) {
- this.innerWorker = innerWorker;
- this.callback = callback;
- }
-
- @Override
- public T call() throws Exception {
- checkForCancelled();
- return innerWorker.call();
- }
-
- @Override
- public ExecutionCallback<T> getExecutionCallback() {
- return callback;
- }
-
- @Override
- public boolean isCancelled() {
- boolean result = super.isCancelled();
- if (innerWorker instanceof HasCancellation) {
- result = ((HasCancellation) innerWorker).isCancelled();
- }
- return result;
- }
-
- @Override
- public void setCancel(boolean isCancelled) {
- super.setCancel(isCancelled);
- if (innerWorker instanceof HasCancellation) {
- ((HasCancellation) innerWorker).setCancel(isCancelled);
- }
- }
-}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java
index f845fffc1de..8107f9d6bc6 100644
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorAdminImpl.java
@@ -17,17 +17,18 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import org.eclipse.osee.event.EventService;
import org.eclipse.osee.executor.admin.ExecutionCallback;
import org.eclipse.osee.executor.admin.ExecutorAdmin;
-import org.eclipse.osee.executor.admin.ExecutorConstants;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.logger.Log;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* @author Roberto E. Escobar
@@ -38,7 +39,6 @@ public class ExecutorAdminImpl implements ExecutorAdmin {
private ExecutorCache cache;
private Log logger;
- private EventService eventService;
public void setLogger(Log logger) {
this.logger = logger;
@@ -48,33 +48,24 @@ public class ExecutorAdminImpl implements ExecutorAdmin {
return logger;
}
- public void setEventService(EventService eventService) {
- this.eventService = eventService;
- }
-
- private EventService getEventService() {
- return eventService;
- }
-
public void start(Map<String, ?> props) {
+ logger.trace("Starting [%s]...", getClass().getSimpleName());
cache = new ExecutorCache();
-
- getEventService().postEvent(ExecutorConstants.EXECUTOR_ADMIN_REGISTRATION_EVENT, props);
}
public void stop(Map<String, ?> props) {
+ logger.trace("Stopping [%s]...", getClass().getSimpleName());
for (Entry<String, ListeningExecutorService> entry : cache.getExecutors().entrySet()) {
shutdown(entry.getKey(), entry.getValue());
}
cache = null;
- getEventService().postEvent(ExecutorConstants.EXECUTOR_ADMIN_DEREGISTRATION_EVENT, props);
}
- public ListeningExecutorService getDefaultExecutor() throws Exception {
+ public ListeningExecutorService getDefaultExecutor() {
return getExecutor(DEFAULT_EXECUTOR);
}
- public ListeningExecutorService getExecutor(String id) throws Exception {
+ public ListeningExecutorService getExecutor(String id) {
ListeningExecutorService service = null;
synchronized (cache) {
service = cache.getById(id);
@@ -83,31 +74,31 @@ public class ExecutorAdminImpl implements ExecutorAdmin {
}
}
if (service == null) {
- throw new IllegalStateException(String.format("Error creating executor [%s].", id));
+ throw new OseeStateException("Error creating executor [%s].", id);
}
if (service.isShutdown() || service.isTerminated()) {
- throw new IllegalStateException(String.format("Error executor [%s] was previously shutdown.", id));
+ throw new OseeStateException("Error executor [%s] was previously shutdown.", id);
}
return service;
}
@Override
- public <T> Future<T> schedule(Callable<T> callable) throws Exception {
+ public <T> Future<T> schedule(Callable<T> callable) {
return schedule(callable, null);
}
@Override
- public <T> Future<T> schedule(String id, Callable<T> callable) throws Exception {
+ public <T> Future<T> schedule(String id, Callable<T> callable) {
return schedule(id, callable, null);
}
@Override
- public <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback) throws Exception {
+ public <T> Future<T> schedule(Callable<T> callable, ExecutionCallback<T> callback) {
return schedule(DEFAULT_EXECUTOR, callable, callback);
}
@Override
- public <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback) throws Exception {
+ public <T> Future<T> schedule(String id, Callable<T> callable, ExecutionCallback<T> callback) {
ListenableFuture<T> listenableFuture = getExecutor(id).submit(callable);
if (callback != null) {
FutureCallback<T> futureCallback = asFutureCallback(callback);
@@ -135,8 +126,11 @@ public class ExecutorAdminImpl implements ExecutorAdmin {
};
}
- private ListeningExecutorService createExecutor(String id, int poolSize) throws Exception {
- ExecutorThreadFactory threadFactory = new ExecutorThreadFactory(id, Thread.NORM_PRIORITY);
+ private ListeningExecutorService createExecutor(String id, int poolSize) {
+ ThreadFactory threadFactory = new ThreadFactoryBuilder()//
+ .setNameFormat(id + "- [%s]")//
+ .setPriority(Thread.NORM_PRIORITY)//
+ .build();
ExecutorService executor = null;
if (poolSize > 0) {
@@ -173,17 +167,17 @@ public class ExecutorAdminImpl implements ExecutorAdmin {
}
@Override
- public void createFixedPoolExecutor(String id, int poolSize) throws Exception {
+ public void createFixedPoolExecutor(String id, int poolSize) {
createExecutor(id, poolSize);
}
@Override
- public void createCachedPoolExecutor(String id) throws Exception {
+ public void createCachedPoolExecutor(String id) {
createExecutor(id, -1);
}
@Override
- public void shutdown(String id) throws Exception {
+ public void shutdown(String id) {
ListeningExecutorService service = cache.getById(id);
if (service != null) {
shutdown(id, service);
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java
index dadba8e0b97..f71044a3403 100644
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java
+++ b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorCache.java
@@ -12,6 +12,8 @@ package org.eclipse.osee.executor.admin.internal;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import com.google.common.util.concurrent.ListeningExecutorService;
/**
@@ -22,15 +24,15 @@ public class ExecutorCache {
private final ConcurrentHashMap<String, ListeningExecutorService> executors =
new ConcurrentHashMap<String, ListeningExecutorService>();
- public void put(String id, ListeningExecutorService service) throws IllegalStateException {
+ public void put(String id, ListeningExecutorService service) {
if (executors.putIfAbsent(id, service) != null) {
- throw new IllegalStateException(String.format("Error non-unique executor detected [%s]", id));
+ throw new OseeStateException("Error non-unique executor detected [%s]", id);
}
}
- public ListeningExecutorService getById(String id) throws IllegalArgumentException {
+ public ListeningExecutorService getById(String id) {
if (id == null || id.length() <= 0) {
- throw new IllegalArgumentException("Error - executorId cannot be null");
+ throw new OseeArgumentException("Error - executorId cannot be null");
}
ListeningExecutorService executor = executors.get(id);
if (executor != null && (executor.isShutdown() || executor.isTerminated())) {
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
deleted file mode 100644
index 647e36a1531..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorThreadFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin.internal;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ExecutorThreadFactory implements ThreadFactory {
-
- private final String threadName;
- private final int priority;
- private final AtomicInteger threadCount = new AtomicInteger(0);
-
- public ExecutorThreadFactory(String threadName, int priority) {
- this.threadName = threadName;
- this.priority = priority;
- }
-
- public ExecutorThreadFactory(String name) {
- this(name, Thread.NORM_PRIORITY);
- }
-
- @Override
- public Thread newThread(Runnable runnable) {
- Thread thread = new Thread(runnable);
-
- String name = String.format("%s: %s", threadName, threadCount.getAndAdd(1));
- thread.setName(name);
-
- int priorityToSet = priority;
- if (priorityToSet > Thread.MAX_PRIORITY) {
- priorityToSet = Thread.MAX_PRIORITY;
- } else if (priorityToSet < Thread.MIN_PRIORITY) {
- priorityToSet = Thread.MIN_PRIORITY;
- }
- thread.setPriority(priority);
-
- return thread;
- }
-
-}
diff --git a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorWorkCache.java b/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorWorkCache.java
deleted file mode 100644
index 719f97d00f2..00000000000
--- a/plugins/org.eclipse.osee.executor.admin/src/org/eclipse/osee/executor/admin/internal/ExecutorWorkCache.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.executor.admin.internal;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Future;
-
-/**
- * @author Roberto E. Escobar
- */
-public class ExecutorWorkCache {
-
- private final Map<UUID, Future<?>> waiting = new ConcurrentHashMap<UUID, Future<?>>();
- private final Map<UUID, Future<?>> executing = new ConcurrentHashMap<UUID, Future<?>>();
-
- public ExecutorWorkCache() {
- //
- }
-
- public void scheduled(UUID id, Future<?> future) {
- waiting.put(id, future);
- }
-
- public void executing(UUID id, Future<?> future) {
- waiting.remove(id);
- executing.put(id, future);
- }
-
- public void completed(UUID id, Future<?> future) {
- waiting.remove(id);
- executing.remove(id);
- }
-
- public int cancelAll() {
- int itemsCancelled = 0;
- itemsCancelled += cancel(waiting.values());
- itemsCancelled += cancel(executing.values());
- return itemsCancelled;
- }
-
- private int cancel(Collection<Future<?>> futures) {
- int cancelCount = 0;
- for (Future<?> future : futures) {
- if (!future.isCancelled() && !future.isDone()) {
- future.cancel(true);
- cancelCount++;
- }
- }
- return cancelCount;
- }
-
- private void cleanUp(Map<UUID, Future<?>> data) {
- List<UUID> toRemove = new LinkedList<UUID>();
- for (Entry<UUID, Future<?>> entry : data.entrySet()) {
- Future<?> future = entry.getValue();
- if (future.isCancelled() || future.isDone()) {
- toRemove.add(entry.getKey());
- }
- }
- for (UUID item : toRemove) {
- data.remove(item);
- }
- }
-
- public int getWaiting() {
- return waiting.size();
- }
-
- public int getExecuting() {
- return executing.size();
- }
-
- public int getInWork() {
- return getWaiting() + getExecuting();
- }
-
- public void cleanUp() {
- cleanUp(waiting);
- cleanUp(executing);
- }
-}

Back to the top