tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Guyatt" <pguy...@telesoft-technologies.com>
Subject RE: Accessing objects with any servlets, where the object is already pre-created
Date Tue, 07 Oct 2003 13:00:25 GMT
Hi there,

It will be a direct reference

thanks

Pete

-----Original Message-----
From: Vidar Langberget [mailto:vidar@langberget.com]
Sent: 08 October 2003 14:00
To: Tomcat Users List
Subject: Re: Accessing objects with any servlets, where the object is
already pre-created


I understand that you can't put every object you want to cache in the
servletcontext, and a holder/wrapper object is needed. But you still need to
call servletContext.getAttribute() once for every request. The question is:
Does it matter performance-wise if the objects you store in the
servletContext are large or small. Ie, when you have the following code:

CacheManager cm = (CacheManager)servletContext.getAttribute("cache"):
FineObj fo = (FineObj)cm.getObject(key);
..

Is cm object getting a reference to the cache attribute(fast), or a copy of
the object stored there(slow)?

Sorry for not making my question clearer.

regards,

Vidar


----- Original Message -----
From: "Tim Funk" <funkman@joedog.org>

> The easy workaround is not store *many* objects into the servletContext
but
> to store a "holder object" into the servletContext.
>
> Rehashing is a non-issue if at initialization time all the information is
> loaded into the servletContext. If not future writes are done into the
> servlet context, then no rehashing is done.
>
> In fact, you can have one object in your servletContext which holds ALL of
> your data. Then you have full control of the hashing issues and don't need
to
> worry about excessive calls to (CAST)servletContext.getAttribute() or
worry
> about static variables.
>




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


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


Mime
View raw message