org.erights.e.elib.ref
Class NearRef

java.lang.Object
  |
  +--org.erights.e.elib.ref.Ref
        |
        +--org.erights.e.elib.ref.NearRef
All Implemented Interfaces:
Amplifiable, Callable

class NearRef
extends Ref

A NearRef represents the Ref facet of a promise which has been fulfilled with a local non-Ref object.

In E, a NearRef is forever identical to the object it wraps (the target). In the ELib implementation, NearRefs exist purely for implementation convenience to wrap a non-Ref with a Ref interface. Note that all non-Refs are considered NEAR.

Author:
Mark S. Miller

Field Summary
private  Object myTarget
           
 
Fields inherited from class org.erights.e.elib.ref.Ref
BROKEN, EVENTUAL, NEAR, TheViciousRef
 
Constructor Summary
(package private) NearRef(Object target)
          Wrap target in Ref protocol.
 
Method Summary
 Object callAll(String verb, Object[] args)
          Synchronously forward the message and response.
(package private)  void commit()
          Used by a resolvers to turn off switchability, and thereby make this Ref equivalent to its current target.
 boolean isResolved()
          Suppressed:
 Throwable optProblem()
          Returns null.
 Object resolution()
          Returns the near object.
(package private)  Ref resolutionRef()
          Returns this, since target isn't a Ref
 Ref sendAll(String verb, Object[] args)
          Asynchronously forward the message and response.
 Throwable sendAllOnly(String verb, Object[] args)
          Asynchronously forward the message.
(package private)  void setTarget(Ref newTarget)
          Used by a resolvers to change the target.
 String state()
          Returns NEAR.
 
Methods inherited from class org.erights.e.elib.ref.Ref
broken, disconnected, getAllegedType, getOptProxyHandler, GetRefMaker, ignore, isBroken, isDeepFrozen, isDeepPassByCopy, isEventual, isFar, isNear, isPassByProxy, isPBC, isPersistent, isResolved, isSameEver, isSelfish, isSelfless, isSettled, makeBufferingPromise, makeSwitchablePromise, optBroken, optProblem, optSealedDispatch, optSealedDispatch, optShorten, promise, resolution, respondsTo, sendMsg, state, toCallable, toRef, toString, whenBroken, whenBrokenOnly, whenResolved, whenResolvedOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myTarget

private final Object myTarget
Constructor Detail

NearRef

NearRef(Object target)
Wrap target in Ref protocol. target must be a non-Ref.

Method Detail

optProblem

public Throwable optProblem()
Returns null.

All implementations of optProblem/0 must be thread safe, in order for Ref.state/0 to be thread safe.

Specified by:
optProblem in class Ref
Returns:
null
See Also:
Ref.optProblem(Object)

resolutionRef

Ref resolutionRef()
Returns this, since target isn't a Ref

All implementations of resolutionRef/0 must be thread safe, in order for Ref.resolution/0 to be thread safe.

Specified by:
resolutionRef in class Ref
Returns:
this.

resolution

public Object resolution()
Returns the near object.

All implementations of resolution/0 must be thread safe, in order for Ref.resolution/1 to be thread safe.

Overrides:
resolution in class Ref
Returns:
the actual target

state

public String state()
Returns NEAR.

All implementations of state/0 must be thread safe, in order for Ref.isNear/1 to be thread safe.

Overrides:
state in class Ref
Returns:
BROKEN
See Also:
Ref.state(Object)

callAll

public Object callAll(String verb,
                      Object[] args)
Synchronously forward the message and response.

Specified by:
callAll in interface Callable
Specified by:
callAll in class Ref

sendAll

public Ref sendAll(String verb,
                   Object[] args)
Asynchronously forward the message and response.

Specified by:
sendAll in class Ref

sendAllOnly

public Throwable sendAllOnly(String verb,
                             Object[] args)
Asynchronously forward the message.

Specified by:
sendAllOnly in class Ref
Returns:
Why wasn't this event queued? It isn't queued if this vat or comm connection is shut down, in which case the returned problem explains why. If null is returned, then the event was queued, though it may still not arrive.

isResolved

public boolean isResolved()
Description copied from class: Ref
Suppressed:

Specified by:
isResolved in class Ref

setTarget

void setTarget(Ref newTarget)
Description copied from class: Ref
Used by a resolvers to change the target. If newTarget is equivalent to this Ref, then this Ref becomes broken by a ViciousCycleException.

Specified by:
setTarget in class Ref

commit

void commit()
Description copied from class: Ref
Used by a resolvers to turn off switchability, and thereby make this Ref equivalent to its current target.

If the current target is already equivalent to this Ref, then this Ref becomes broken by a ViciousCycleException.

Specified by:
commit in class Ref


comments?