Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need understanding of @AccessTimeout

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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.

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2337
87
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • 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
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic