I am using the @Singleton and @Startup annotations together to create a long running process. By using these annotation can I safely assume that my process will be a single thread running fully asynchronously?
I am using the @Singleton and @Startup annotations together to create a long running
Share
You can use these annotations just at the class-level, so I’m not sure what ‘process’ do you refer to (@PostConstruct method?)
I don’t remember any part of the EJB 3.1 specification which talks about the required asynchronous singleton initialization.
4.8.1 Singleton Initialization:
It rather depends on the Application Server vendor what technique of initialization he choose. I would not assume that the loading will occur in a separate process but rather just that it will occur during server startup and before serving clients.
ENTERED FROM COMMENTS:
what about providing a separate asynchronous EJB method for your time-consuming operation which will be invoked from your singleton initializer EJB?