wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes EJB and synchronisation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB and synchronisation" Watch "EJB and synchronisation" New topic
Author

EJB and synchronisation

sunil s phanse
Greenhorn

Joined: Sep 17, 2002
Posts: 1
Hello
Can i call any synchronized method of a class from an EJB. We r facing a problem wherein we are calling 1 synchronized method from onMessage() of MDB.
We are trying to use the 3rd party Java classes available for connection pool. They have implimented this in java class inside synchronized method/block. When we call this from EJB we face problems. Is there any solution to this other than doing everything inside EJB
[ December 05, 2003: Message edited by: sunil s phanse ]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
What kind of "problems" do you face? What is happening?
The EJB spec forbids you to make EJB methods synchronized, but it's generally OK to call a synchronized method in a helper class...
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

but it's generally OK to call a synchronized method in a helper class...

That is a violation as well,isn't?


Groovy
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Well, it's a bit of a grey area. Section 24.1.2 of the EJB 2.0 spec says
"� An enterprise Bean must not use thread synchronization primitives to synchronize execution of multiple instances.
Same reason as above. Synchronization would not work if the EJB Container distributed enterprise bean�s instances across multiple JVMs."
This is the only statement about synchronization primitives in the spec that I know of. In fact, the usual test for this is to make sure that none of the EJB methods themselves implement synchronized, no vendor that I know of will check the call trees descending from the bean.
Kyle
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Kyle,
Thanks.
How is your Websphere book writing going on ? Does IBM plan to come out with any Webservices certifications?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Hi Pradeep.
The WebSphere book should be released on December 17! As for Web Services certifications, I know some are in the pipeline but aren't aware of any dates. You may want to ask Howard Kushner -- his company is usually deeply involved in writing the tests and certification guides.
Kyle
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Originally posted by Kyle Brown:
Hi Pradeep.
The WebSphere book should be released on December 17! As for Web Services certifications, I know some are in the pipeline but aren't aware of any dates. You may want to ask Howard Kushner -- his company is usually deeply involved in writing the tests and certification guides.
Kyle

Are you planning for any book promotion ?
How do I contact Howard Kushner ?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
My book will be featured on JavaRanch the week of January 20th. Howard hangs around here -- do a search for his name, then PM him.
Kyle
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

I have sent a PM to Howard.
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: EJB and synchronisation
 
Similar Threads
EJB3 Dependency Injection: How to write ApplicationClient injecting @EJB correctly ?
Transaction Context and Persistance context
EJBs and syncronized methods...
Please explain this sentence