java - Jboss 7 Destroy Singleton EJB -


@startup @singleton @accesstimeout(value = 0) public class myejb { @schedule(dayofweek = "*", hour = "*", minute = "*", second = "*/20", year = "*", persistent = false, info = "myejb job.................")     @accesstimeout(value = 0)     public void execute() {         try {             lgg.debug("starting...........");             thread.sleep(35000);             lgg.debug("ending.............");         } catch (interruptedexception e1) {         } } 

i have following code. want stop(destroy) current ejb working after 20 second , start singltone ejb instance. how achieve that?

this not possible. cannot safely force thread stop in jvm, , there no mechanism in ejb interrupt thread. best can cooperatively interrupt: call method on singleton notify wake (that is, change thread.sleep else countdownlatch). note, you'll need change default @lock or @concurrencymanagement allow bean reentrant.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -