tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter lin <peter....@labs.gte.com>
Subject Re: Sharing an object between servlets
Date Fri, 04 Oct 2002 15:23:58 GMT


I've built something similar to this in the past.  In my case, I was
using a popular enterprise mapping API to generate the maps with points
of interest (easy to guess which one).  I stored long/lat of a user's
recent published locations in the database.  IE, the user has some kind
of mobile device which publishes it's long/lat periodically.

a web page then displays a map with a series of points. To get the time
when the user published the point, image map is used. the image map is
generated with the same long/lat in the database, but transformed from
long/lat to pixel coordinates.

I used several approaches, including sticking it in the session, but
that got really slow with a couple simultaneous requests. Worked great
for one person, but not under load. Your best bet is to either use a
single as suggested by others, or write a webapp which starts with
tomcat.

This way it gives you more flexibility. If your building a field force
application like for a shipping company to track their trucks, the
webapp solution might be better. If you're database is on serious
hardware and can handle hundreds of simultaneous connections, it might
be more scalable. Again, it all depends on how it will be used in
production.


peter


Vijay Kandy wrote:
> 
> The number of coordinates is huge - in thousands so cant put them in the
> URL.
> 
> I have attempted your second idea. And yes I go to the DB for each request.
> The problem with the Singleton is, I donno who should start the class. If
> the HTML servlet starts the Singleton, will the object still be accessible
> to the image servlet?
> 
> Thank you,
> -Vijay
>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message