File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Need understanding of @AccessTimeout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Need understanding of @AccessTimeout " Watch "Need understanding of @AccessTimeout " New topic
Author

Need understanding of @AccessTimeout

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

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.


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1518
    
  22

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

Joined: May 18, 2010
Posts: 634

Thanks Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need understanding of @AccessTimeout
 
Similar Threads
Networking : RMI
Locking, about sentence: "consuming no CPU cycles"
Should lock methods be callable by the client
concurrency in local mode
Livelock same as race condition?