java.lang.Object | +--org.erights.e.elib.ref.Ref | +--org.erights.e.elib.ref.BufferingRef
A BufferingRef, although a proper Ref, is intended for use (by composition) only within other Ref implementations. A BufferingRef is forever EVENTUAL, and simply stores all Messages asynchronously sent to it in a buffer, a FlexList of Messages, acting in the role of its resolver. In other word, a buffering promise consists two facets: a BufferingRef and the FlexList into stores the incoming messages. The static method deliverAll() is provided for use on the buffer, effectively acting as a resolver method.
A BufferingRef points at its buffer weakly, since if no one else still has ahold of the buffer, there's no reason to keep it. In this case, incoming messages are silently ignored with no externally visible effect. Therefore, even though the non-determinism of GC timing is visible within the implementation of a buffering promise, it presents its clients with a fully deterministic contract.
(package private) void
commit()
(package private) static int
deliverAll(FlexList buf,
Object target)
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
private final java.lang.ref.WeakReference myBuf
BufferingRef(FlexList resolver)
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 RefRef.optProblem(Object)Ref resolutionRef()
All implementations of resolutionRef/0 must be thread safe, in
order for Ref.resolution/0 to be thread
safe.
resolutionRef in class Refpublic String state()
All implementations of state/0 must be thread safe, in order
for Ref.isNear/1 to be thread safe.
Ref.state(Object)public Object callAll(String verb, Object[] args)
public void sendMsg(Message msg)
Ref
To the client, this has the same semantics as Ref.sendAll(java.lang.String, java.lang.Object[]) or
Ref.sendAllOnly(java.lang.String, java.lang.Object[]), and the default implementation here in Ref just
delegates to these. However, those subclasses that can reuse
the Message should do so as a nice optimization, and to preserve the
SendingContext info
captured in msg for causality tracing and debugging.
XXX SECURITY ALERT, No longer true:
This is package scope, since only trusted code is assumed to not
resuse a Resolver so as to break distributed transparency. (This
safeguard isn't crucial, and isn't even a big deal, but is nice.)
public Ref sendAll(String verb, Object[] args)
public Throwable sendAllOnly(String verb, Object[] args)
sendAllOnly in class Refpublic boolean isResolved()
Ref
isResolved in class Refvoid setTarget(Ref newTarget)
Ref
void commit()
Ref
If the current target is already equivalent to this Ref, then this Ref
becomes broken by a ViciousCycleException.
static int deliverAll(FlexList buf, Object target)