aspose file tools
The moose likes Threads and Synchronization and the fly likes need help on ExecutorService? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "need help on ExecutorService?" Watch "need help on ExecutorService?" New topic
Author

need help on ExecutorService?

Mohamad Norouzi
Greenhorn

Joined: Oct 12, 2004
Posts: 18
Hi friends,

We have a BeanLocator class in which we look up EJBs needed. this is a utility class that uses InitialContext of the EJB

there are many classes that are not EJBs so we can't inject the EJB services into them. That is why we create a simple locator.

now I am going to increase the performance of accessing this locator. currently the methods of this locator are synchronized and it is created as a singleton.

now this is the code I am using for the better performance. since this is first time I am using ExecutorService and the concept is a bit strange for me I would like you help me if this works fine and whether this is thread safe or not.

thanks in advance

here is the code:


the client classes will use as follows:


please note that we can use BeanLocator (without s) individually but because it needs to be initialized so this creation has expensive cost and we need to create it once.

[ July 22, 2008: Message edited by: mohammad norouzee ]
[ July 22, 2008: Message edited by: mohammad norouzee ]

<a href="http://pixelshot.wordpress.com" target="_blank" rel="nofollow">http://pixelshot.wordpress.com</a><br /><a href="http://brainable.blogspot.com" target="_blank" rel="nofollow">http://brainable.blogspot.com</a>
Mohamad Norouzi
Greenhorn

Joined: Oct 12, 2004
Posts: 18
Any idea?
Mohamad Norouzi
Greenhorn

Joined: Oct 12, 2004
Posts: 18
Hi friends
I am still waiting for your comment
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help on ExecutorService?
 
Similar Threads
Thread question
readObject() eat memory !!!
Help me see if possible Generic DAO Factory
Is this Dao?
java.util.Timer inside Runnable?