org.erights.e.elib.ref
Class UnconnectedRef

java.lang.Object
  |
  +--org.erights.e.elib.ref.Ref
        |
        +--org.erights.e.elib.ref.UnconnectedRef
All Implemented Interfaces:
Amplifiable, Callable, Marker, PassByConstruction, Persistent, Serializable

class UnconnectedRef
extends Ref
implements Persistent, PassByConstruction

If an unresolved reference becomes Broken without first being Resolved, it becomes an UnconnectedRef (an Unsettled Broken reference).

A UnconnectedRef will never designate an object, but provides a Throwable explaining why not (the problem). An UnconnectedRef is not sameness-comparable to anything else, including itself. A UnconnectedRef is forever Broken by the same problem and without any sameness identity.

A UnconnectedRef's contents must be transitively transparently Selfless and passable by construction. UnconnectedRef is listed as implementing PassByConstruction for implementation reasons only. Not being NEAR, by definition it is not a PassByContruction object.

Author:
Mark S. Miller

Field Summary
private  Throwable myProblem
           
private static long serialVersionUID
           
 
Fields inherited from class org.erights.e.elib.ref.Ref
BROKEN, EVENTUAL, NEAR, TheViciousRef
 
Fields inherited from interface org.erights.e.elib.serial.Persistent
HONORARY, HONORED_NAMES
 
Fields inherited from interface org.erights.e.elib.serial.PassByConstruction
HONORARY, HONORED_NAMES
 
Constructor Summary
(package private) UnconnectedRef(Throwable problem)
          Makes a Ref that will never designate an object because of problem.
 
Method Summary
 Object callAll(String verb, Object[] args)
          This default implementation switches on state() and either synchronously forward the message, if we're NEAR, or complains.
(package private)  void commit()
          Used by a resolvers to turn off switchability, and thereby make this Ref equivalent to its current target.
private  Throwable doBreakage(String verb, Object[] args)
          Should be called only if the state is already BROKEN.
 boolean isResolved()
          Suppressed:
 Throwable optProblem()
          Returns this broken ref's problem.
(package private)  Ref resolutionRef()
          Returns this.
 Ref sendAll(String verb, Object[] args)
          Suppressed: Use E.sendAll(obj, verb, args) rather than obj.sendAll(verb, args).
 Throwable sendAllOnly(String verb, Object[] args)
          Suppressed: Use E.sendAllOnly(obj, verb, args) rather than obj.sendAllOnly(verb, args).
(package private)  void setTarget(Ref newTarget)
          Used by a resolvers to change the target.
 String state()
          Returns BROKEN.
 
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, 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

serialVersionUID

private static final long serialVersionUID

myProblem

private final Throwable myProblem
Constructor Detail

UnconnectedRef

UnconnectedRef(Throwable problem)
Makes a Ref that will never designate an object because of problem.

Method Detail

optProblem

public Throwable optProblem()
Returns this broken ref's problem.

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:
our problem
See Also:
Ref.optProblem(Object)

resolutionRef

Ref resolutionRef()
Returns this.

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.

state

public String state()
Returns BROKEN.

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)

doBreakage

private Throwable doBreakage(String verb,
                             Object[] args)
Should be called only if the state is already BROKEN.

Takes care of __whenMoreResolved(reactor) and __whenBroken(reactor). If you know verb/args aren't one of these, you don't need to call doBreakage()


callAll

public Object callAll(String verb,
                      Object[] args)
This default implementation switches on state() and either synchronously forward the message, if we're NEAR, or complains.

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

sendAll

public Ref sendAll(String verb,
                   Object[] args)
Description copied from class: Ref
Suppressed: Use E.sendAll(obj, verb, args) rather than obj.sendAll(verb, args).

Specified by:
sendAll in class Ref

sendAllOnly

public Throwable sendAllOnly(String verb,
                             Object[] args)
Description copied from class: Ref
Suppressed: Use E.sendAllOnly(obj, verb, args) rather than obj.sendAllOnly(verb, args).

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?