org.erights.e.elib.vat
Class WeakPtr

java.lang.Object
  |
  +--java.lang.ref.Reference
        |
        +--java.lang.ref.WeakReference
              |
              +--org.erights.e.elib.vat.WeakPtr

public class WeakPtr
extends java.lang.ref.WeakReference

Untamed: The E-equivalent of WeakReference.

A WeakPtr without an reactor is just an unregistered Java WeakReference. A WeakPtr with an reactor also has the additional behavior of doing

    reactor <- run()
when the referent gets GCed.

Confined E code must not be given access to weak references of any kind, as that would expose them to GC timing non-determinism. This non-determinism can be logged, so it doesn't threaten replay, but it would enable a confined Bob to read a covert channel written by Mallet, and so enable Bob to receive instructions from Mallet.

Author:
Mark S. Miller

Field Summary
(package private)  Message myMessage
          The message to be sent to myReactor to inform it that referent is toast.
(package private)  Object myReactor
          Package-scope so it can be grabbed by the WeakPtrThread.
(package private)  Vat myVat
          Package-scope so it can be grabbed by the WeakPtrThread.
 
Constructor Summary
WeakPtr(Object referent, Object reactor, String verb, Object[] args)
          Enabled: Makes a WeakPtr to referent that eventually notifies the reactor by
WeakPtr(Object referent, Runnable reactor)
          Enabled: Makes a WeakPtr to referent that eventually notifies the reactor by
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myVat

final Vat myVat
Package-scope so it can be grabbed by the WeakPtrThread.


myReactor

final Object myReactor
Package-scope so it can be grabbed by the WeakPtrThread.


myMessage

final Message myMessage
The message to be sent to myReactor to inform it that referent is toast.

Stored on creation of this WeakPtr in order to capture the SendingContext. Package-scope so it can be grabbed by the WeakPtrThread.

Constructor Detail

WeakPtr

public WeakPtr(Object referent,
               Object reactor,
               String verb,
               Object[] args)
Enabled: Makes a WeakPtr to referent that eventually notifies the reactor by
    reactor <- verb(args..)
after the referent has been GCed.


WeakPtr

public WeakPtr(Object referent,
               Runnable reactor)
Enabled: Makes a WeakPtr to referent that eventually notifies the reactor by
    reactor <- run()
after the referent has been GCed.



comments?