com.opensymphony.oscache.base
Class EntryUpdateState

java.lang.Object
  extended bycom.opensymphony.oscache.base.EntryUpdateState

public class EntryUpdateState
extends java.lang.Object

Holds the state of a Cache Entry that is in the process of being (re)generated. This is not synchronized; the synchronization must be handled by the calling classes.

Version:
Revision: $
Author:
Chris Miller, Author: $

Field Summary
static int NOT_YET_UPDATING
          The initial state when this object is first created
static int UPDATE_CANCELLED
          Update cancelled state
static int UPDATE_COMPLETE
          Update complete state
static int UPDATE_IN_PROGRESS
          Update in progress state
 
Constructor Summary
EntryUpdateState()
           
 
Method Summary
 void cancelUpdate()
          Updates the state to UPDATE_CANCELLED.
 void completeUpdate()
          Updates the state to UPDATE_COMPLETE.
 boolean isAwaitingUpdate()
          This is the initial state when an instance this object is first created.
 boolean isCancelled()
          The thread that was responsible for updating the cache entry (ie, the thread that managed to grab the update lock) has decided to give up responsibility for performing the update.
 boolean isComplete()
          The update of the cache entry has been completed.
 boolean isUpdating()
          The cache entry is currently being generated by the thread that got hold of the update lock.
 void startUpdate()
          Attempt to change the state to UPDATE_IN_PROGRESS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_YET_UPDATING

public static final int NOT_YET_UPDATING
The initial state when this object is first created

See Also:
Constant Field Values

UPDATE_IN_PROGRESS

public static final int UPDATE_IN_PROGRESS
Update in progress state

See Also:
Constant Field Values

UPDATE_COMPLETE

public static final int UPDATE_COMPLETE
Update complete state

See Also:
Constant Field Values

UPDATE_CANCELLED

public static final int UPDATE_CANCELLED
Update cancelled state

See Also:
Constant Field Values
Constructor Detail

EntryUpdateState

public EntryUpdateState()
Method Detail

isAwaitingUpdate

public boolean isAwaitingUpdate()
This is the initial state when an instance this object is first created. It indicates that a cache entry needs updating, but no thread has claimed responsibility for updating it yet.


isCancelled

public boolean isCancelled()
The thread that was responsible for updating the cache entry (ie, the thread that managed to grab the update lock) has decided to give up responsibility for performing the update. OSCache will notify any other threads that are waiting on the update so one of them can take over the responsibility.


isComplete

public boolean isComplete()
The update of the cache entry has been completed.


isUpdating

public boolean isUpdating()
The cache entry is currently being generated by the thread that got hold of the update lock.


cancelUpdate

public void cancelUpdate()
Updates the state to UPDATE_CANCELLED. This should only be called by the thread that managed to get the update lock.


completeUpdate

public void completeUpdate()
Updates the state to UPDATE_COMPLETE. This should only be called by the thread that managed to get the update lock.


startUpdate

public void startUpdate()
Attempt to change the state to UPDATE_IN_PROGRESS. Calls to this method must be synchronized on the EntryUpdateState instance.


See www.opensymphony.com for more information.