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 ]