Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Ranch Foreman
Posts: 1897
12
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • 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".
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic