[concurrency-interest] Re: PooledLinkedBlockingQueue
Mon, 1 Nov 2004 22:26:26 -0800 (PST)
On Mon, 2 Nov 2004, Larry Riedel wrote:
> I think it is particularly lame to have to create/destroy an
> object for every time the pooled object is put/taken, when a
> mechanism for avoiding that (WeakReference/ReferenceQueue) is
> already in the JVM and just lacks a ReRegisterForFinalize()
> (CLR) style method. But I would not object to the idea of
> having a pool specific object for each pooled object, one which
> has the same lifetime as the pooled object, but has (for
> example) a finalizer so the pooled object does not have to.
I doubt that weak references perform much better than finalizers.
They tend to use roughly the same implementation mechanism. (I haven't
looked at Sun's specifically.) You'd still need awfully expensive
object constructors for this sort of strategy to pay off.