• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need understanding of @AccessTimeout

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Source EJB 3.1 spec.



4.8.5.1 Container Managed Concurrency

A concurrent access attempt that is not allowed to proceed due to locking is blocked until it can make forward progress.
Timeouts can be specified via metadata so that a blocked request can be rejected if a lock is not acquired within a certain amount of time.

4.8.5.5.1 Concurrent Access Timeouts

A concurrent access attempt that can not immediately acquire the appropriate lock is blocked until it can make forward progress.
@AccessTimeout is used to specify the amount of time the access attempt should be blocked before timing out.

Please let me know if my understanding of @AccessTimeout is correct or incorrect:

Suppose value provided in @AccessTimeout is 30 seconds for a particular Singleton Bean method.
If 2 clients try to access the bean method at same time for write operation,then one of the client call will be blocked for the period as specified in @AccessTimeout.
If the first client operation is completed within 20 seconds then second client request can be executed.
If first client operation takes more than 30 seconds ,then second client operation will time-out.

 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Correct and the second client in your last example will receive a ConcurrentAccessTimeoutException (subclass of EJBException) on the time-out.

Regards,
Frits
 
Mohit G Gupta
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frits
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic