This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Object Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object Pool" Watch "Object Pool" New topic
Author

Object Pool

Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hallo

I deal in a GUI with a lot images(gufs, jpgs) and because some of them are uses in more than one place I try to manage them with via a casche mechanism.
So I build a pool where I keep all my the imaget that I use(see the code below).


I know that a similar map mechanism exist already for WeakReferences (java.util.WeakHashMap) but I use (explicit) the soft references for them quality - the garbage collector might clear a soft reference but always clears a weak referencen.
It this ok ? There are also other opinion about this?


SCJP, SCJD, SCWCD, OCPJBCD
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'm moving this to the Advanced forum...
[ December 04, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Object Pool
 
Similar Threads
a simple WeakReference and SoftReference exemple
Phantom Reference
What exactly is enqueued in a ReferenceQueue
A few problems with the Custom Cursor
Object Pool