-
1. Re: Client pooling of EJB references
jwkaltz Apr 16, 2002 2:20 AM (in response to guy_rouillier)We have a similar situation; I clocked the lookup of home to take quite long, so we are "pooling" the home interfaces (I'm just putting them in a Hashtable); you can definitely do this without risk and that already saves a lot of time.
I'm using the ServiceLocator pattern, so a singleton (static) instance of this java class with a Hashtable of home interfaces which have already been looked up (plus any other resources you need to look up). This ServiceLocator lives in your client (in your case, Tomcat). All you need to do is find a reasonable place to initialize it since it needs initialization parameters (such as EJB naming host name & port) - I'm doing that when the first user logs in. -
2. Re: Client pooling of EJB references
guy_rouillier Apr 17, 2002 1:54 PM (in response to guy_rouillier)Thanks for the ideas. Let's say I want to store the home object somewhere. Where should I put it - into a session variable? That would limit it to this one session. I'd like to be able to share the home objects across multiple sessions/users. I can't figure out where I would put this pool so that multiple users can get to it.
-
3. Re: Client pooling of EJB references
davidjencks Apr 17, 2002 9:55 PM (in response to guy_rouillier)You could always run tomcat by itself in jbossmx... and use an mbean;-) I haven't tried it, but could you bind them in tomcat's jndi?
-
4. Re: Client pooling of EJB references
cjne Apr 18, 2002 5:42 PM (in response to guy_rouillier)I have noticed that if you have a cached home object and try to use it after jboss has been restarted it will not work very well. If i remember it right it would give you strange errors such as "No such entity" or similar.
I guess that this problem never occuer if you have jboss and tomcat running in the same VM but you should test it if you have them separated.
I used a singelton to store my pool of home objects and read the "init params" from tomcat's jndi context. -
5. Re: Client pooling of EJB references
guy_rouillier Apr 26, 2002 4:11 PM (in response to guy_rouillier)I've noticed everyone on this discussion mentions caching the home interface. Why that instead of the remote one? I've seen no problems with several different clients keeping a remote object open against the same EJB. Does the lookup of the home take the majority of the setup time compared to creating the remote object?