On Tue, Mar 10, 2009 at 10:40 AM, Jochen Theodorou <[email protected]> wrote:

> Is there any material about plans to add ephemerons to the JDK? Using
> google I wasn't able to ind anything. Only that thread is takling about
> it seems.

It seems to me that it should be possible to simulate ephemerons today
using phantom refs.  The ephemeron is created with a key and a value,
and holds a strong reference to the value.  It creates a reference
queue and requests a phantom reference to the key -- we subclass
PhantomReference so that we can recover the ephemeron.

A low-priority thread polls the queue; when a key has been GC'd, the
ephemeron is informed, gets a weak reference to the held value, drops
the strong value, and hangs on to the weak ref.

Does that seem feasible?

-- 
GMail doesn't have rotating .sigs, but you can see mine at
http://www.ccil.org/~cowan/signatures

--~--~---------~--~----~------------~-------~--~----~
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