Saturday 26 July 2014

Strong reachable Object

Prior to introducing ref package only strong references exist. Strong reference are also called Hard references. Hard references are normal references, i.e. variables, as opposed to subclasses of java.lang.ref.Reference, phantom, soft, and weak references.

Ex:
Object obj1 = new object()

As per Java specification, An object is strongly reachable if it can be reached by some thread without traversing any reference objects. A newly-created object is strongly reachable by the thread that created it.

Strong reachable objects will not be garbage collected until all strong references to them are set to null. I.e, objects that are reachable through any chain of strong references are not eligible for garbage collection.



Prevoius                                                 Next                                                 Home

No comments:

Post a Comment