Skip to content
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

Improve start up of scheduler background thread #2

Open
neshanjo opened this issue Jan 11, 2017 · 0 comments
Open

Improve start up of scheduler background thread #2

neshanjo opened this issue Jan 11, 2017 · 0 comments

Comments

@neshanjo
Copy link
Owner

Currently, the background thread is started by a GET on /api/wakeup in a ServletContextListener (see BackgroundTaskStarter). It is done this way in order to have EntityManagerFactory and SwitchControl injected. However, this is more a workaround than an elegant solution.

(A non-solution for me would be to write a separate instantiation for EntityManagerFactory and SwitchControl - the instantiation should happen in one place only!)

Possible more elegant ways:

  • Find a way of using jersey's dependency injector to inject these dependencies directly into BackgroundTaskStarter (I haven't found any...)
  • Use a different dependency injection framework that is available both in REST resource classes and servlet context listeners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant