|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.jeri.internal.runtime.ImplRefManager.ImplRef
final class ImplRefManager.ImplRef
A managed reference to a remote object implementation (impl). An ImplRef may be pinned and unpinned with respect to any target that is registered with it. While pinned for at least one target, an ImplRef refers to its impl with a strong reference; otherwise, it refers to the impl with only a weak reference, so that the impl may be locally garbage collected. The getImpl() method can be used to obtain a strong reference to the impl as long as it has not been garbage collected. An ImplRef maintains a set of all targets that are registered with it-- that is, targets passed to ImplRefManager.getImplRef but not passed to the release method. If the impl is detected to have been garbage collected, then all targets in the set will have their collect() method invoked asynchronously.
Field Summary | |
---|---|
private Set |
pinningTargets
targets that have pinned this reference; guarded by "this" |
private boolean |
removed
removed from table; guarded by "lock" |
private Remote |
strongRef
strong reference to impl, when pinned; guarded by "this" |
private Set |
targets
targets for all exports of referenced impl; guarded by "this" |
private Reference |
weakRef
weak reference to impl |
Constructor Summary | |
---|---|
private |
ImplRefManager.ImplRef(Reference weakRef)
|
Method Summary | |
---|---|
private void |
addTarget(Target target)
|
(package private) Remote |
getImpl()
Returns the referenced impl, or null if the impl has been garbage collected. |
private void |
invokeUnreferenced(Target target)
Asynchronously invokes the Unreferenced.unreferenced method of the impl, if it is an instance of the Unreferenced interface. |
private boolean |
isPinned()
|
(package private) void |
pin(Target target)
Pins this reference for the specified target, so that the impl will be held with a strong reference. |
(package private) void |
release(Target target)
Removes the specified target from the set of targets that are using this ImplRef, allowing the target to be garbage collected (and this ImplRef too, if there are no other targets using it). |
private void |
remove()
Removes this ImplRef from the table. |
String |
toString()
|
(package private) void |
unpin(Target target)
Unpins a previous pin of this reference. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final Reference weakRef
private boolean removed
private final Set targets
private final Set pinningTargets
private Remote strongRef
Constructor Detail |
---|
private ImplRefManager.ImplRef(Reference weakRef)
Method Detail |
---|
private void addTarget(Target target)
Remote getImpl()
void pin(Target target)
void unpin(Target target)
private void invokeUnreferenced(Target target)
private boolean isPinned()
void release(Target target)
private void remove()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |