Skip to content

AsyncHttpClientConfig throws an exception if we pass a managed executor service #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hmashlah opened this issue Oct 14, 2013 · 8 comments
Assignees
Milestone

Comments

@hmashlah
Copy link

Glassfish 4 implementation of JavaEE 7 managed executor service throws an exception if a life cycle method is called e.g isShutDown
This method is called in AsyncHttpClientConfig if an applicationThreadPool is passed to it.

@slandelle
Copy link
Contributor

Which version did you use?
Does this happen with the Netty provider too?
Could you provider exact stacktrace, please?

@hmashlah
Copy link
Author

I tried using 1.7.19 and 1.7.20 and it did not work (I see that this call is commented on the master but I did not try it)
I am using Netty provider. Following is the stacktrace
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:89)
... 149 more
Caused by: java.lang.IllegalStateException: Lifecycle operation not supported
at org.glassfish.enterprise.concurrent.AbstractManagedExecutorServiceAdapter.isShutdown(AbstractManagedExecutorServiceAdapter.java:68)
at com.ning.http.client.AsyncHttpClientConfig$Builder.build(AsyncHttpClientConfig.java:1099)
at org.mashlah.MyDownloadService.init(MyDownloadService.java:62)
at org.mashlah.MyDownloadService.init(MyDownloadService.java:58)
... 154 more

@slandelle
Copy link
Contributor

@rlubke
Copy link
Contributor

rlubke commented Oct 14, 2013

That EE Concurrent Utilities spec states the following for ManagedExecutorServices:

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().

The branch logic referenced by Stephane tries to prevent the user from passing an ExecutorService that has already been shutdown, however, I given the above, I think we should remove that safety check. If the user in a non EE environment passes an invalid ExecutorService, we can let an error occur then.

@slandelle
Copy link
Contributor

👍

@hmashlah
Copy link
Author

That sounds good.
Thanks
On Oct 14, 2013 6:18 PM, "Stephane Landelle" [email protected]
wrote:

[image: 👍]


Reply to this email directly or view it on GitHubhttps://github.com//issues/402#issuecomment-26267720
.

@rlubke
Copy link
Contributor

rlubke commented Oct 14, 2013

I've pushed 1.7.21-SNAPSHOT to sonatype maven repo. Mind giving it a shot and verify resolution?

@hmashlah
Copy link
Author

The problem is resolved. Thanks

rlubke added a commit that referenced this issue Oct 15, 2013
rlubke added a commit that referenced this issue Oct 15, 2013
@ghost ghost assigned rlubke Oct 15, 2013
cs-workco pushed a commit to cs-workco/async-http-client that referenced this issue Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants