eclipse-ee4j / eclipse-ee4j/jersey

Custom ExecutorServiceProvider is not picked up when registered through ComponentProvider

Open
#3,695 1 comment 0 reactions 0 assignees View on GitHub
asynchronous-processing hk2 Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

Hi. I have switched from Jersey 2.13 to 2.25.1 and following issue appeared:

When i create custom ExecutorServiceProvider annotated with @ManagedAsyncExecutor and register it through ResourceConfig, everything works fine, threads from custom Executor are used to process incoming @Async requests. Everything is OK.

The problem appears when i try to register custom provider using ComponentProvider. My custom one is just ignored and default jersey one is used.

As WA i found out that i can either annotate my ExecutorServiceProvider with org.glassfish.jersey.internal.inject.Custom annotation or "annotate" it with internal @Custom by myself calling following snippet:

```
Injections.addBinding(Injections.newBinder(CustomExecutorProvider.class).
to(ExecutorServiceProvider.class).
in(Singleton.class).
qualifiedBy(CustomAnnotationLiteral.INSTANCE).
named("CustomExecutorProvider"),
dc);
```

It seems to me that during runtime my custom provider is not processed correctly, i think jersey should annotate my custom provider with internal @Custom annotation for later injection.

Please check following https://github.com/hwasin/jettyJerseySandbox for bug reproduce

Is this a bug or i just missing something?

Thank you!

UPDATE:
After more debugging i've noticed that if i use Jersey 2.13 with hk2 2.3.0-b10 everything is OK, but if update hk2 to >= 2.4.0 and use same 2.13 Jersey injection stops working.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.