执行器服务关闭不受支持。

huangapple go评论59阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2020年7月25日 01:02:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/63078226.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定