org.erights.e.elib.ref
Class DisconnectedRef
java.lang.Object
|
+--org.erights.e.elib.ref.Ref
|
+--org.erights.e.elib.ref.DisconnectedRef
- All Implemented Interfaces:
- Amplifiable, Callable, Marker, PassByConstruction, Persistent, Serializable
- class DisconnectedRef
- extends Ref
- implements Persistent, PassByConstruction
What a FarRef becomes when it breaks -- a BROKEN Ref with identity.
Maintains the same()ness identity and sameness hash of the FarRef. A
DisconnectedRef is listed as an HONORARY Selfless object for
implementation reasons only: (HONORARY because it encapsulates its
identity, so it isn't transparent).
A DisconnectedRef's contents must be transitively transparently Selfless
and passable by construction. DisconnectedRef 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
Fields inherited from class org.erights.e.elib.ref.Ref
Fields inherited from interface org.erights.e.elib.serial.Persistent
Constructor Summary
(package private)
DisconnectedRef(Throwable problem,
Object identity)
Makes a Ref that will never deliver messages to any object because of
problem, but which is considered the same() as a particular object.
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.
boolean
equals(Object other)
As an HONORARY Selfless object, my .equals() and .hashCode()
determine sameness.
int
hashCode()
As an HONORARY Selfless object, my .equals() and .hashCode()
determine sameness.
Ref
sendAll(String verb,
Object[] args)
Suppressed: Use E.sendAll(obj, verb, args) rather than obj.sendAll(verb, args).
(package private) void
setTarget(Ref newTarget)
Used by a resolvers to change the target.
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
Field Detail
serialVersionUID
private static final long serialVersionUID
myProblem
private final Throwable myProblem
myIdentity
final Object myIdentity
Constructor Detail
DisconnectedRef
DisconnectedRef(Throwable problem,
Object identity)
- Makes a Ref that will never deliver messages to any object because of
problem, but which is considered the same() as a particular object.
Iff two [Broken]FarRefs have the same() identity, then they are
considered the same().
identity must itself be an honorary Selfless object.
Method Detail
equals
public boolean equals(Object other)
- As an HONORARY Selfless object, my .equals() and .hashCode()
determine sameness.
NOTE: Uses myIdentity's .equals(), which is safe, as myIdentity must
be an honorary Selfless object.
- Overrides:
equals in class Object
- Parameters:
other - the reference object with which to compare.
- Returns:
true if this object is the same as the obj
argument; false otherwise.- See Also:
Object.hashCode(),
java.util.Hashtable
hashCode
public int hashCode()
- As an HONORARY Selfless object, my .equals() and .hashCode()
determine sameness.
NOTE: Uses myIdentity's .hashCode(), which is safe, as myIdentity must
be an honorary Selfless object.
- Overrides:
hashCode in class Object
- Returns:
- a hash code value for this object.
- See Also:
java.lang.Object#equals(java.lang.Object),
java.util.Hashtable
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().
-
- Returns:
- Why wasn't a __whenMoreResolved/1 or __whenBroken/1 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 message wasn't
__whenMoreResolved/1 or __whenBroken/1, in which case there was
nothing to queue, or it was one of these and it was queued,
though it may still not arrive.
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
-