question regarding the resource pool pattern
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   John_Zhang
Posted On:   Monday, February 9, 2004 07:31 AM

J2EE resource pool pattern says:the resource can be cached like this: class resourcePool(){ private Map pool public addRecource(){ } .... } once the recouce need,if it's not in the pool,get it and add into pool by put new reource into the Map.if another client need to access it,get from pool directly. my question is how does client get the instance of resourcePool. for ex. the client A request a servelet say "sa",sa need to get an instance of resourcePool object,let's say "ra",and some resource been put into the Map: ra.pool. another client B,request a servlet "sb", sb get an object of class resourcePool, "rb", in rb,   More>>
			
J2EE resource pool pattern says:the resource can be cached like this:
class resourcePool(){
private Map pool

public addRecource(){
}

....

}

once the recouce need,if it's not in the pool,get it and add into pool by put new reource into the Map.if another client need to access it,get from pool directly.

my question is how does client get the instance of resourcePool.
for ex. the client A request a servelet say "sa",sa need to get an instance of resourcePool object,let's say "ra",and some resource been put into the Map: ra.pool.
another client B,request a servlet "sb", sb get an object of class resourcePool, "rb", in rb,at this time,the Map pool is empty,how can rb get the resource from pool since pool is not a static property of resourcePool?
   <<Less

Re: question regarding the resource pool pattern

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, February 9, 2004 07:52 AM

Usually you have a factory method, or finder, etc. to get the resource pool, which is a singleton of some kind (either a static member of the class, or via a JNDI lookup etc.)

About | Sitemap | Contact