Stateless Session Bean is cheap. Make a new one each time.
You might discover that your EJB container of choice makes and discards
a new SLSB instance with each invocation anyway. If so, the
"optimization" is esp. ill-advised since exception handling is an
expensive program flow construct.
You might also find that even if the handle remained valid,
reconstituting the SB is slower than making a new SLSB each time.
Fred Loney
Spirited Software, Inc.
www.spiritedsw.com
----- Original Message -----
From: "Rub�n Mellado Mu�oz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 10:07 AM
Subject: Question about EJB stateless session & handle object
> I have got a question about EJB session stateless & handle.
> I get the handle of the EJB (session stateless) on the init method of
a
> servlet, and in the service method I do the following statements:
>
> private FooEJB foo; // EJB session stateless
> private Handle fooHandle; //Handle of the foo EJB
>
> public void init()
> {
> .....
> fooHandle = foo.getHandle();
> }
> public HttpResponse service (....)
> {
> try
> {
> this.foo.doSomething();
> }
> catch (RemoteException e)
> {
> // If the there is an exception I try the business mehtod
again
> try
> {
> foo = fooHandle.getEJBObject();
> this.foo.doSomething();
> catch(Exception ex)
> {
> // trace error
> }
> }
> }
>
> With this statements I try to avoid invoking the create method of the
> EJB in each service method call, to increase the performance, so I
store
>
> the handle of the EJB and if a RemoteException is thrown i try to get
> the EJB again. What do you think about this? is this correct or
wrong?,
> more solutions ?
>
> Thanks in advance.
>
>
========================================================================
===
> 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".
>
===========================================================================
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".