Hi,

>
> in many EJB samples I have seen that people create the
> InitialContext and do
> the lookup on each request. I just wonder whether it is
> necessary or can I
> just do it once at the bean level in ejbCreate or setEntityContext to
> improve the performance? If I can do it only once per bean,
> where shall I do
> the initilization for the different beans? session beans in
> ejbCreate and
> entity beans in setEntityContext?
>

I've got the same question, but I want to go even further: not only cache
the InitialContext, but cache the result in a static Hashtable, maybe
something like this:

public static Object lookup(String name) {
        Object object = hashtable.get(name);
        if (object == null) {
                object = context.lookup(name);
                hashtable.put(name, object);
        }
        return object;
}

Is this /impossible/good/bad practice... ?


bye, Heiko

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to