> Mark de Lange wrote:
>
> The problem is that I don't know where to run the customer, basket and
> product objects. One possibility is to run them in de Java Virtual
> Machine of the HTTP-server. But how can I create and manage these
> objects without using a servlet? For example, when the HTTP-server
> starts, I want to create the product-instances to build the initial
> product-catalog.

You could try this (I'm doing it). Let's see you have a "server" object
that handles customer, basket and product objects let's call it
"ShoppingManager".

Every servlet that uses "ShoppingManager" then gets a handle to that
singleton by using

ShoppingManager.getInstance()

getInstance() will start the shopping manager the first time
it is accessed. Later calls will just pass the reference to the already
running ShoppingManager.

The problem here is. Geez, I have a long init time, the first customer
will stay there waiting for a while for ShoppingManager to start.
One way to get around this is to write a little script that calls
a bogus servlet that just calls getInstance() when you want to
start your application.

There might be better ways to do this, but this is a really esy way
to do this :)

> Another way is to run these objects in a Java application and let the
> servlets communicate with this application using RMI, but I expect
> performance problems using this method.

I wouldn't do this.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to