concurrency - EJB polls periodically concurrent Queue -


this scenario have 2 singleton ejb. first 1 receive data , writes in queue data structure instantiated other ejb.

@singleton @startup public class client implements iclient {  @ejb iclientinqueue reporter; .... @asynchronous public void update(string message){     statusmessage m = new statusmessage();     reporter.addstatusmessage(m);  }   @startup @singleton public class clientinqueue implements iclientinqueue {  private concurrentlinkedqueue<statusmessage> statusinqueue;     addstatusmessage(string m) ..add element queue 

this works fine. want poll periodically queue , make dispatching operation. issue can't use runnable in ejb context. i'm looking migrate spring, first of make want know if i'm missing something. thanks

... want poll periodically queue..

if need execute code periodically, java ee specification provides service called timer service useful in these cases. service gives posibility execute code @ defined interval time.

my issue can't use runnable in ejb context.

since java ee 7 (jsr 236: concurrency utilities), exists possibility create managed thread, allows run new threads within container in safe way.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -