Search code examples
javawebsphereexecutorservicejava.util.concurrent

Executor service shutdown is not supported


I am using the executor service provided by IBM Websphere 8.5.5

ExecutorService es = (ExecutorService ) new InitialContext().lookup("wm/default")

when I call es.shutdown()method, I get the error:

java.lang.IllegalStateException: ASYN0093E: The operation shutdown is not supported.

Why Websphere does not support the shutdown method? Should not I call that method?


Solution

  • WebSphere Application Server rejects the shutdown method in order to comply with the following requirement of the Concurrency Utilities for Java EE Specification, Section 3.1.6: Lifecycle , which states:

    The lifecycle of ManagedExecutorService instances are centrally managed by the application server and cannot be changed by an application.

    And more explicitly, Section 3.1.6.1 Java EE Product Provider Requirements , which explicitly states:

    The lifecycle of a ManagedExecutorService is managed by an application server. All lifecycle operations on the ManagedExecutorService interface will throw a java.lang.IllegalStateException exception. This includes the following methods that are defined in the java.util.concurrent.ExecutorService interface: awaitTermination(), isShutdown(), isTerminated(), shutdown(), and shutdownNow().

    It seems likely this requirement exists to prevent applications from interfering with each other when both use the same executor.