• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Timer won't continue to retry after two transaction rollback.

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used Ivan's code example to see if the timer will be cancelled after two consecutive rollback:


Console output:

Info: ProgrammaticTimerStartedBean.initialize: Tue Mar 24 17:57:33 EDT 2015
Info: Context : ProgrammaticTimerStartedBean; id: [B@3ad5ff73
Info: Rollback only: false
Info: TimerExample was successfully deployed in 5,288 milliseconds.

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:57:38 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9992
Info: Rollback only: false

.....
Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:58:38 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9995
Info: Rollback only: true
//after the first rollback, the container restarts the timer
//The timer continues
Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:58:43 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 4987
Info: Rollback only: false


Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:58:48 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9995
Info: Rollback only: false

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:58:58 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9995
Info: Rollback only: false

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:59:08 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9996
Info: Rollback only: false

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:59:18 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9996
Info: Rollback only: true

//after this rollback, the container restarts the timer
Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:59:23 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 4989
Info: Rollback only: false

.....
Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 17:59:58 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9998
Info: Rollback only: true

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:00:03 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 4990
Info: Rollback only: false

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:00:08 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9998
Info: Rollback only: false

Info: Total number of available updates : 48
Info: Number of available updates since Mon Mar 23 17:59:43 EDT 2015 : 0

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:00:18 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9999
Info: Rollback only: true

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:00:23 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 4991
Info: Rollback only: false

.......

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:02:38 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 9988
Info: Rollback only: true

Info: ProgrammaticTimerStartedBean.ejbTimeout : Tue Mar 24 18:02:43 EDT 2015 , info:Timer Info
Info: Security Principla: ANONYMOUS
Info: Time remaining: 4981
Info: Rollback only: true
Info: EJB5119:Expunging timer ['1@@1427234253673@@server@@domain1' 'TimedObject = ProgrammaticTimerStartedBean' 'Application = TimerExample' 'BEING_DELIVERED' 'PERIODIC' 'Container ID = 93535223729815552' 'Tue Mar 24 17:57:38 EDT 2015' '10000' ] after [2] failed deliveries




At the end, the container does not restart the timer after 2 consecutive transaction rollback and the timer is cancelled at the end.
The JSR 318 says the container will retry to start the timer after a transaction rollback. But the specification does not say how many retries the container should do.
I think Glassfish's specifies to cancel the timer after 2 consecutive rollbacks.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2533
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is a server specific feature which most likely you can influence by a proprietary setting. The specs only say that the container should try "at least once".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic