An Ephemeron is an object which refers strongly to its contents as long as theEphemeron's key is not garbage collected, and weakly from then on. Ephemeronssolve a problem which is commonly found when trying to "attach" properties toobjects by using a registry. When some property should be attached to anobject, the property should (in terms of GC behavior) typically have the life-time that an instance variable of this object would have. However, this iscomplicated by having an external association between the object and itsproperty such as: registry ------------ association ------------- object|||vproperty Here, the registry (a third party) will hold onto the association itself whichwould require manual removal from the registry (instead of automated garbagecollection). While this problem can be always be solved in any given concretesituation by using one of the various weak association types, choosingthe 'right' kind of association depends on a variety of factors some of whichcan change dynamically. Ephemerons solve this problem by defining that the 'contents' (value) of anEphemeron will be held strongly until the key is known to be garbagecollected. From then on, the contents of the ephemeron will be held weakly.Therefore, the contents of an ephemeron can only become eligible for garbagecollection if and only if the key is garbage collectable which is the exactbehavior which we would observe for an instance variable of the object.