Well... thank you for the educative answer :-)
  My application have to types of objects that are constantly created and
destroyed
  1- Objects that handle user interaction. Basically they are the objects that
delegates tasks that would be otherwise done using servlets. JSPs send data to
them (like html form data) and they process it and return the results to the
browser. These ones i'm not sure (yet) if I should cache. I'm not familiar
with Struts, I would like to know how it does that. Someone can give me some tips?
  2- These I strongly believe I should cache. I have some database tables that
stores user permissions on the application. Basically, there are two tables
that stores an module ID and who can access it (by user id, user profession,
etc). As these objects are implemented now, each visited page does and query
to the database to check permissions... that seems quite bad IMHO. Maybe I
could simply load all of them in memory at system startup and update them from
time to time (or using Observable interfaces)?
  Suggestions?

>You may want to pursue object pooling, but the prevailing conventional
>wisdom is that it's not really necessary. Object Pooling is important for
>objects that are particularly expensive to create (due to internal object
>requirements, like connecting to external resources) and is not really
>appropriate simply for "lots" of standard generic Java objects.
>
>While instantiating an object certainly has some cost, creating and tossing
>them away is not overly expensive.
>
>Now, perhaps you've done some testing and found these particular objects to
>be problematic, but it seems to me to be a toss up between simply creating
>new objects versus using an object pool. Any object pool is necessarily
>going to at least have synchronization issues tied to it which may in the
>end cost more overall than creating and disposing of the objects.
>
>Modern GCs are pretty good about tossing away temporary objects.
>
>Now, if you're perhaps doing some things in a tight loop, then maybe simply
>a judicious use of the objects would be better. Say, rather than using a
>generic object pool, simply creating the few necessary instances for your
>loop before hand and reusing them explicity within the loop rather than
>constantly creating new ones.
>
>Regards,
>
>Will Hartung
>([EMAIL PROTECTED])


Felipe Schnack
Analista de Sistemas
[EMAIL PROTECTED]
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
[EMAIL PROTECTED]
Fone/Fax.: (51)32303328


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

Reply via email to