英文:
Executor service shutdown is not supported
问题
我正在使用IBM Websphere 8.5.5提供的执行器服务。
ExecutorService es =(ExecutorService)new InitialContext()。lookup(“wm/default”)
当我调用es.shutdown()
方法时,我收到以下错误:
java.lang.IllegalStateException:ASYN0093E:不支持操作关闭。
为什么Websphere不支持关闭方法?我不应该调用那个方法吗?
英文:
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?
答案1
得分: 3
WebSphere Application Server拒绝了shutdown
方法,以遵守Concurrency Utilities for Java EE Specification第3.1.6节中所述要求,该节规定:
> ManagedExecutorService实例的生命周期由应用服务器集中管理,无法由应用程序更改。
更明确地说,第3.1.6.1节Java EE产品提供商要求明确规定:
> ManagedExecutorService的生命周期由应用服务器管理。ManagedExecutorService接口上的所有生命周期操作都将抛出java.lang.IllegalStateException异常。这包括在java.util.concurrent.ExecutorService接口中定义的以下方法:awaitTermination()、isShutdown()、isTerminated()、shutdown()和shutdownNow()。
这个要求似乎存在是为了防止两个应用程序在两者都使用相同执行程序时相互干扰。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论