What stateless means is that if you acquire a reference to the stateless bean
object there is no guarantee that the state will be the same on each call. So
for example,
MyStatelessHome stHome =
(MyStatelessHome)narrow(context.lookup("MyStatelessHome"),
MyStatelessHome.class)
MyRemote st = stHome.create();
System.out.println(st.getAField());
System.out.println(st.getAField());
For stateless beans the above code could potentially print 2 different results.
But that doesn't mean that a stateless bean can't have any fields.
So for example you could cache information in a stateless bean if the
information being cached will never change and if you are willing to have the
cache repeated in each stateless bean that the container happens to create.
For example suppose you want to cache the entire data that is contained in some
table of the database. You know that data will rarely change. If it does you
set a flag in the db to indicate that it has. You could write a stateless bean
that loads the data. Before each call it checks the flag. If the data has
changed it reloads from the database.
The container may create several bean instances to perform any calls you make,
so this cache would be reproduced in each of those instances.
dan
Peter Delahunty wrote:
> >If we use stateless session beans, where can we cache the
> > data retrieved from the database?
>
> To overlap here a bit Can someone explain to me how you can use a stateless
> session bean to cache information taken from a database. If the EJB is
> stateless then where do you store the information.
>
> -----Original Message-----
> From: Jeff Davidson [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 16, 2000 12:53 AM
> To: [EMAIL PROTECTED]
> Subject: Caching data in an stateful session EJB???
>
> We are designing a system based on J2EE and EJB which needs to service
> thousands
> of client applications. Originally we thought that each client would
> interact
> with one stateful session EJB in order to collect & cache data pulled from
> corporate databases. However, ass I've been reading more on EJBs, it sounds
> like this may not be a very good approach in terms of scaling and
> performance. If we use stateless session beans, where can we cache the
> data retrieved from the database? We need the data for subsequent
> calls to a rules-based engine to have it process and return information
> which we then return to the client app. Then, as we collect information
> from the client app, we need to combine this with the data from the
> db to be able to make more requests to the rules-based engine. So we need
> to cache it somewhere, but where?
>
> The machines we're running this stuff on are HP K380 w/2 CPUs and
> 2 GB memory. We expect to start with 1000 simultaneous clients scaling
> up to 6000 for the call center. Then we will have the web clients to
> worry about on top of that, which will likely be 1000's more. Each channel
> (web and call center) will have it's own HP K380 (2 cpus) running the
> WebLogic app server.
>
> Thanks in advance for any advice/information.
>
> Jeff
>
> ===========================================================================
> 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".
===========================================================================
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".