IMHO, it is always best to keep state out of EJB's when at all possible
for performance and scalability reasons.

-----Original Message-----
From: Erik Price [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2003 9:39 AM
To: Struts Users Mailing List
Subject: Re: [OT] Session Management using EJB



Nimish Chourey , Tidel Park - Chennai wrote:
> Hi all ,
>       I want to know if there are  applications that implements
Session
> Management using EJB's  rather then using the HttpSession on Web tier
.
> I want to know the pros and cons of this approach . For all the R&D
that I
> have done , it seems that this approach could be used when you are
deploying
> your application in a clustered environment , where it is really a
over head
> to duplicate the sessions on all the servers in the cluster .
> Still I am in dilemma , whether to follow this approach or not ??
> This is really off topic , but I guess many of the developers here
must have
> come across this ..
> Any sort of help , pointers is really appreciated .

Nimish,

I may be completely wrong about this, but here are my thoughts...

As I'm sure you are aware, the purpose of the "session" in web 
applications is to maintain state between stateless HTTP requests. 
Thus, there is an HttpSession object available at the web tier (since 
presumably in 99.9% of situations, any HTTP requests will be handled at 
the web tier).

In web applications that are not browser based (specifically, rich 
clients and applets), there is not the same need to persist state using 
a "session" object, because the state can be maintained in the client.

Beyond the web tier, in the EJB tier, I don't think that there is a need

to persist state beyond what session beans already offer.  In other 
words, you can use a stateful session bean to perform a complicated 
action (or a stateless session bean for a simple action).  But once the 
action is complete, you don't want the bean hanging around, it should be

returned to the pool quickly to service the needs of other clients.  The

HttpSession is a comparatively lightweight object that you can use for 
persisting simple state information.

I think that what you are really looking for is clustering for 
HttpSession objects, so that in a clustered environment, the HttpSession

is replicated transparently.  You can try to roll your own, but this is 
really an infrastructural area that is the responsibility of the 
container provider.  Therefore, you should turn to your application 
server for this feature.  (And I thought I heard that Tomcat is planning

to have something like this in 5.0)


Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to