org.ov4j.cache
Class DelayedCacher
java.lang.Object
org.ov4j.cache.DelayedCacher
- All Implemented Interfaces:
- java.lang.Runnable
public class DelayedCacher
- extends java.lang.Object
- implements java.lang.Runnable
This is the background thread which will cache results.
- Author:
- smolloy
Field Summary |
protected java.util.TimerTask |
theTimer
Task which will set the timeout flag after the timeout period. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
theTimer
protected java.util.TimerTask theTimer
- Task which will set the timeout flag after the timeout period.
DelayedCacher
public DelayedCacher(MethodCaller theCaller,
Version<ClassComparable> theVersion,
long theTimeout,
CachedResultId theId,
CacheHandler theCache,
boolean addBeforeCommit)
- Constructor.
- Parameters:
theCaller
- The thread making the call.theVersion
- The result to cache.theTimeout
- The timeout period.theId
- The ID to use for storing the result.theCache
- The CacheHandler.addBeforeCommit
- Whether or not the ID should be added as well as the result committed.
getTheVersion
public Version<ClassComparable> getTheVersion()
- Returns:
- Returns the result.
hasTimedout
public boolean hasTimedout()
- Returns:
- Returns the timedout.
run
public void run()
- Perform caching. Will try sleeping until the method caller is done, then will cache the result.
- Specified by:
run
in interface java.lang.Runnable
setTimedout
public void setTimedout(boolean timedout)
- Parameters:
timedout
- The timedout to set.
Copyright © 2004-2007 Steve Molloy. All Rights Reserved.