Thanks again Leon :)

2007/1/4, Leon Rosenberg <[EMAIL PROTECTED]>:

there are 4 scopes or visibilities/lifecycles of attributes in the
servlet/jsp world.

page : the jsp page, same as local variable in a class.
request: the duration of the request over multiple pages
session: the duration of the user session, over multiple requests
application scope: the whole webapp.

However, talking about one of these scopes, you are always talking
about _one_ server and _one_ webapp.

So the application scope is something which belong to a) webapp and b)
server in first line.

As for multi-server environment - there are a lot of details here, and
I don't really know whether yours handle application scope like a
cluster-scope or not.
I would assume that each server has its own copy created at the start
of the server / deployment of the application.

In my world, if I'd have to implement this requirement I would select
one of two choices:

In both:  Create a service which manages the data and speaks to the db.

Option 1. A thread in the application (or timer event, or scheduler)
checks periodically (depending on the requirements it could be 1
minute or 15) with the service whether the local data is still
up-to-date. This can be done by comparing version numbers or creation
timestamps. If not the data in the application scope gets replaced.

Option 2. Service distributes new versions of the data via some
publisher/subscriber mechanism, like JMS, CORBA
Event/NotificationService, or something you develop yourself. The
subscriber resides in the webserver and puts updated data into the
local application scope.

Option 3. You may also use whatever capabilities your environment has,
if any. But I'd be very careful with loadbalancing and scope
distribution, 99.99% of what I saw sofar sucked badly.

regards
Leon







On 1/4/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Thanks Leon!!!
>
> Ok I made it using the servletcontext like you have said :-), with this
>
> servlet.getServletContext().setAttribute("objHospital", objHospital);
>
> All works fine, even if the user made a mistake :)
>
> One question:
>
> 1- I dont understand something about the servletContext, which is the
> problem of have multiple-server configuration? In both servers the data
is
> store in the servlet context right? I guess the problem is that in some
> moment the objHospital in one server is diferent to the objHospital in
other
> server because it change in the database? Or that the actions of one war
> don´t have the same servlet context that the actions on other war? I
really
> don´t understand this, can you explain me that, like i said all works
fine
> but i want to understand this.
>
> Thanks
>
>

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


Reply via email to