On Fri, Nov 19, 2010 at 11:50 AM, Charles Oliver Nutter
<[email protected]> wrote:
> In order for the WeakReference to show up in the queue, the Channel it
> references would have to get collected...in which case I would no
> longer be able to close it. Am I missing something?

It's worth saying that a Reference/Queue approach *would* work well
for eliminating the finalizer. I would essentially have a
PhantomReference that holds state from our finalizing
ChannelDescriptor wrapper and poll a queue. When ChannelDescriptor
goes away, the phantom would be enqueued and I could clean up lazily.

We generally try to avoid spinning up worker threads for anything in
JRuby, due to some container limitations (like on Google AppEngine)
and due to the complexity of managing those threads' lifecycles. So
we'd need the default case to not use a thread and just
poll-on-create-IO to scrub out previously collected and enqueued
phantoms.

- Charlie

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to