I have an Action class that calls methods on an
EJB (stateless session bean acting as session facade).
To improve performance I'm thinking to store the reference to the EJB object (i.e stub) as an instance variable like so -
public class TestAction extends Action
{
EJB1Local oEJB1 = null;
public TestAction ()
{
EJB1LocalHome home = ... get home object
oEJB1 = homeDataEngine.create();
}
then when each time the action's called do this -
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
oEJB1.method1(........);
oEJB1.method1(........);
}
I can't determine from the EJB
doc's if this is safe or not - should I just be storing the home ref (EJB1LocalHome) & doing a .create everytime before I want to use it or what?
Any ideas?
Hopefully I've explained it ok?
thanks
harry