|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elib.ref.Ref | +--org.erights.e.elib.ref.SwitchableRef
All message asyncronously delivered to a SwitchableRef will be forwarded its current target. A SwitchableRef starts out switchable, in which case it stays EVENTUAL and does not reveal its current target. While it is switchable, its Resolver can change its target, and can make it unswitchable. Once it's unswitchable, its Resolver can do neither, and the SwitchableRef becomes equivalent to its target -- ie, it can shorten.
Field Summary | |
private boolean |
myIsSwitchable
Can myTarget (and myIsSwitchable) be changed? |
private Ref |
myTarget
The current destination for all messages. |
Fields inherited from class org.erights.e.elib.ref.Ref |
BROKEN, EVENTUAL, NEAR, TheViciousRef |
Constructor Summary | |
(package private) |
SwitchableRef(Ref target)
|
Method Summary | |
Object |
callAll(String verb,
Object[] args)
Suppressed: Use E.callAll(obj, verb, args) rather than obj.callAll(verb, args). |
(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()
As long as I'm switchable, I'm EVENTUAL so my optProblem must be null, even if my target is BROKEN. |
(package private) Ref |
resolutionRef()
If this has been shortened (target set and committed), then return that target; else return 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). |
void |
sendMsg(Message msg)
Override to pass the Message through to the resolved target. |
(package private) void |
setTarget(Ref newTarget)
Used by a resolvers to change the target. |
String |
state()
If shortened (targetted and committed), returns the target's state(); else returns EVENTUAL. |
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, 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 |
private Ref myTarget
private boolean myIsSwitchable
Constructor Detail |
SwitchableRef(Ref target)
Method Detail |
public Throwable optProblem()
All implementations of optProblem/0 must be thread safe, in
order for Ref.state/0
to be thread safe.
optProblem
in class Ref
Ref.optProblem(Object)
Ref resolutionRef()
All implementations of resolutionRef/0 must be thread safe, in
order for Ref.resolution/0
to be thread
safe: If resolutionRef/0 is called from another thread while this
ref is in the middle of being shortened, then resolutionRef/0 must
return either this or what this ref is being shortened to.
XXX Although the implementation doesn't synchronize, it is inductively thread safe given a simple memory model. Is it safe in Java's complex memory model? Do we care -- are any Java implementations not faithful to the simple memory model?
resolutionRef
in class Ref
public String state()
All implementations of state/0 must be thread safe, in order
for Ref.isNear/1
to be thread safe.
state
in class Ref
Ref.state(Object)
public Object callAll(String verb, Object[] args)
Ref
callAll
in interface Callable
callAll
in class Ref
public void sendMsg(Message msg)
sendMsg
in class Ref
public Ref sendAll(String verb, Object[] args)
Ref
sendAll
in class Ref
public Throwable sendAllOnly(String verb, Object[] args)
Ref
sendAllOnly
in class Ref
public boolean isResolved()
Ref
isResolved
in class Ref
void setTarget(Ref newTarget)
Ref
setTarget
in class Ref
void commit()
Ref
If the current target is already equivalent to this Ref, then this Ref
becomes broken by a ViciousCycleException
.
commit
in class Ref
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |