|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.ref.ProxyResolver
Untamed: A maker on demand of a Proxy as well as the resolver of this Proxy.
I use a WeakPtr to point at my Ref so it may be GCed. Note that ProxyResolver exposes its ProxyHandler. If this isn't suitable for you, wrap it.
Field Summary | |
private ProxyHandler |
myOptHandler
While my Ref is handled, it delegates many of my decisions to this handler. |
private Object |
myOptIdentity
The basis for the settled identity of the FarRef I make, or null if I make a RemotePromise. |
private WeakPtr |
myOptRefPtr
Once it's done, it stops holding the weak ptr. |
Constructor Summary | |
ProxyResolver(ProxyHandler handler)
Enabled: optIdentity defaults to null. |
|
ProxyResolver(ProxyHandler handler,
Object optIdentity)
Enabled: @param handler Delegates delegatable eventual-ref behavior to the handler. |
Method Summary | |
void |
__printOn(TextWriter out)
Enabled: |
Object |
getOptIdentity()
Enabled: |
static ProxyHandler |
getOptProxyHandler(Unsealer unsealer,
Object ref)
Enabled: If 'ref' is a remote reference over some comm system and 'unsealer' is the magic unsealer for that comm system, then return ref's ProxyHandler. |
private Ref |
getOptRef()
Gets the Ref if it's still there. |
Ref |
getProxy()
Enabled: Gets my Ref, or quietly remakes it if the old one is gone. |
boolean |
isDone()
Enabled: |
ProxyHandler |
optHandler()
Enabled: |
void |
reactToGC()
Enabled: Automatically eventually invoked when one of my Refs have gone away. |
void |
resolve(Object target)
Enabled: |
boolean |
resolveRace(Object target)
Enabled: Resolves the proxy to become the target. |
boolean |
smash(Throwable problem)
Enabled: |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private ProxyHandler myOptHandler
When I'm done, I set my handler to null.
private Object myOptIdentity
private WeakPtr myOptRefPtr
Constructor Detail |
public ProxyResolver(ProxyHandler handler)
public ProxyResolver(ProxyHandler handler, Object optIdentity)
optIdentity
- If null, the handled reference will be unresolved
(a RemotePromise). If non-null, the optIdentity must
be an honorary Selfless
object. This
includes java.math.BigInteger
and
net.captp.jcomm.ObjectID
. The identity
object serves as the basis for the sameness identity
of the resulting handled resolved reference
(FarRef).Method Detail |
public boolean isDone()
isDone
in interface Resolver
public Object getOptIdentity()
private Ref getOptRef()
public Ref getProxy()
public ProxyHandler optHandler()
public void reactToGC()
Normally just forwards the reactToGC() to myOptHandler. But, in order to avoid a race condition, it only does so if there's no current Ref. There might be a current Ref if getProxy() was called after the old Ref was GCed, but before I was notified. Note that multiple Refs might be created and GCed before I get notified, in which case I might notify myOptHandler multiple times.
public boolean resolveRace(Object target)
In CapTP, there are two reasons this might normally happen:
resolveRace
in interface Resolver
target
-
public void resolve(Object target)
resolve
in interface Resolver
target
- public boolean smash(Throwable problem)
smash
in interface Resolver
problem
-
Resolver.resolveRace(java.lang.Object)
public void __printOn(TextWriter out) throws IOException
IOException
public static ProxyHandler getOptProxyHandler(Unsealer unsealer, Object ref)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |