java - EJB timer ignores TransactionTimeout -


i have ejb timer in ear, deployed on jboss 6.4. in 99% of cases timer works fine, takes bit long finish , throws persistenceexception: transaction rolled in different thread!.

i have found due transacion timeout value low. not want edit default value rather override method-specific timeout. solve split functionality 2 methods: 1 method annotated @timeout , 1 work.

here timer implememntation:

@singleton public class mytimer implements sometimerinterface {      @ejb     private somemanager mymanager;      @resource     private timerservice timerservice;      private timer timer;      @override     public void starttimer() {          // timer scheduled fire every 7th minute         scheduleexpression schedule = new scheduleexpression();         schedule = schedule.hour("*").minute("*/7").second("00");          timerconfig config = new timerconfig();         config.setpersistent(false);          timer = timerservice.createcalendartimer(schedule, config);     }      @timeout     @accesstimeout(value = 20, unit = timeunit.minutes)     public void handletimeout() {          workinnewthread();     }      @transactionattribute(transactionattributetype.requires_new)     @transactiontimeout(unit = timeunit.seconds, value = 900)     public void workinnewthread() {          // can take 1 sec 15 min.         list<object> objects = mymanager.getallthedatabaseobjects();     } } 

however, timer seems ignore transactiontimeout still times out after 5 minutes (default value). how can override default timeout make sure timer finishes job?

not sure whether correct. code call workinnewthread() @timeout method, there method cleanup() tx attribute.

i guess call methods in same bean @timeout. in case annotations, neither @txattribute nor txtimeout, take effect container not control internal method invocation. need use different ejb or self reference let controller work. other option annotate timeout method directly.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -