com.sun.jini.outrigger
Class EntryTransition

java.lang.Object
  extended by com.sun.jini.outrigger.EntryTransition

 class EntryTransition
extends Object

Object that that represents a visibility transition of some entry.


Field Summary
private  boolean available
          true if the entry is transitioning from a state where it could not be taken to one where it could be, false otherwise.
private  EntryHandle handle
          The EntryHandle of the entry that changed
private  boolean newEntry
          true if the transition is a write or the commit of a write, false otherwise.
private  TransactableMgr txn
          If this is a transition to visibility and/or availability, what transaction the entry is now available/visible to.
private  boolean visible
          true if the entry is transitioning from a state where it could not be read to one where it could be, false otherwise.
private  Set watchers
          Set of watchers that need to remember that they have seen this transition already
 
Constructor Summary
EntryTransition(EntryHandle handle, TransactableMgr txn, boolean available, boolean visible, boolean newEntry)
          Create a new EntryTransition object with the specified content.
 
Method Summary
(package private)  EntryHandle getHandle()
          Return the EntryHandle for entry undergoing the visibility transition.
(package private)  TransactableMgr getTxn()
          If this is a transition to visibility and/or availability, what transaction the entry is now available/visible to.
(package private)  boolean hasProcessed(TransitionWatcher w)
          Return true if the passed watcher has been passed to processedBy.
(package private)  boolean isAvailable()
          Returns true if this is a transition from a state where the entry could not be taken to one where it could be.
(package private)  boolean isNewEntry()
          Return true if this transition represents a new entry becoming visible, otherwise return false.
(package private)  boolean isVisible()
          Returns true if this is a transition from a state where the entry could not be read to one where it could be.
(package private)  void processedBy(TransitionWatcher w)
          Record that a given watcher has processed this Transition and does not need to again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handle

private final EntryHandle handle
The EntryHandle of the entry that changed


txn

private final TransactableMgr txn
If this is a transition to visibility and/or availability, what transaction the entry is now available/visible to. If null the entry transitioned to a state where it is available/visible to all.


available

private final boolean available
true if the entry is transitioning from a state where it could not be taken to one where it could be, false otherwise.


visible

private final boolean visible
true if the entry is transitioning from a state where it could not be read to one where it could be, false otherwise.


newEntry

private final boolean newEntry
true if the transition is a write or the commit of a write, false otherwise.


watchers

private final Set watchers
Set of watchers that need to remember that they have seen this transition already

Constructor Detail

EntryTransition

EntryTransition(EntryHandle handle,
                TransactableMgr txn,
                boolean available,
                boolean visible,
                boolean newEntry)
Create a new EntryTransition object with the specified content.

Parameters:
handle - The EntryHandle of the the entry who's visibility is changing.
txn - If the entry is only visible in a particular transaction, the Txn for that transaction, and null otherwise.
available - true if the entry is transitioning from a state where it could not be taken to one where it could be, false otherwise.
visible - true if the entry is transitioning from a state where it could not be read to one where it could be, false otherwise.
newEntry - true if the entry is available and the transition is because of a write or a write that is being committed, false otherwise.
Throws:
NullPointerException - if handle is null.
Method Detail

getHandle

EntryHandle getHandle()
Return the EntryHandle for entry undergoing the visibility transition.

Returns:
The handle for the entry undergoing the visibility transition.

getTxn

TransactableMgr getTxn()
If this is a transition to visibility and/or availability, what transaction the entry is now available/visible to. If null the entry transitioned to a state where it is available/visible to all.

Returns:
the transaction the associated entry is now available/visible too

isAvailable

boolean isAvailable()
Returns true if this is a transition from a state where the entry could not be taken to one where it could be. Otherwise returns false. Note, isVisible returning true implies that isAvailable will also return true.

Returns:
true if this is a transition from a state where the entry could not be taken to one where it could be. Otherwise returns false

isVisible

boolean isVisible()
Returns true if this is a transition from a state where the entry could not be read to one where it could be. Otherwise returns false. Note, isVisible returning true implies that isAvailable will also return true.

Returns:
true if this is a transition from a state where the entry could not be read to one where it could be. Otherwise returns false

isNewEntry

boolean isNewEntry()
Return true if this transition represents a new entry becoming visible, otherwise return false.

Returns:
Return true if this transition represents a new entry becoming visible, otherwise return false.

processedBy

void processedBy(TransitionWatcher w)
Record that a given watcher has processed this Transition and does not need to again. Assumes that the processedBy and hasProcessed methods are only called from a single thread.

Note, we never remove watchers from the set of watchers that have processed this transition since in general we would only know to remove a watcher when this transition had already visited every template, at which point the entire EntryTransition object is eligible for GC (internally we could use a weak set, but once watchers start processing an EntryTransition, its life time is limited so it hardly seems worth the trouble)


hasProcessed

boolean hasProcessed(TransitionWatcher w)
Return true if the passed watcher has been passed to processedBy. Assumes that the processedBy and hasProcessed methods are only called from a single thread.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.