asynchronous - Most efficient way to provide EJB @Aynchronous methods for stateless logic -
asynchronous - Most efficient way to provide EJB @Aynchronous methods for stateless logic -
i need create ejbs provide @aynchronous
methods.
some of ejbs have no state whatsoever.
some might have cdi-injected (using @inject
) threadsafe instance variables @applicationscoped
.
is next efficient way this?:
@singleton @concurrencymanagement(bean) public class ejbclass { @asynchronous public void asyncmethod() { //some code } }
my sec guess use: @stateless
instead of pair of @singleton
& @concurrencymanagement(bean)
.
but there shouldn't need more 1 instance of of these ejbs, so, unless i'm missing gotcha @singleton
, imagine @singleton
efficient.
i using ejb 3.2 in glassfish 4.1.
i agree assessment @singleton
+ @concurrencymanagement(bean)
fit problem description. highlight, @stateless
has disadvantage might build multiple instances if there concurrent calls. overhead probably, might avoid since it's easy so.
asynchronous glassfish singleton ejb stateless-session-bean
Comments
Post a Comment