org.gcube.informationsystem.cache.consistency.manager.poll
Class CacheRefresher

java.lang.Object
  extended by java.lang.Thread
      extended by org.gcube.informationsystem.cache.consistency.manager.poll.CacheRefresher
All Implemented Interfaces:
java.lang.Runnable

public class CacheRefresher
extends java.lang.Thread

Basic cache refreshment component. It operates based on a simple poll algorithm. On regular time intervals it retrieves from the IS server all the RIs of the services registered to be monitored. It build a new cache object on every refresh cycle and simply assigns it to the original cache object.

Author:
UoA

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CacheRefresher(long ttr, SrvRegistry registry)
          Public constructor
 
Method Summary
protected  java.util.Date getLastRefreshDate()
           
protected  long getRefreshCycleTime()
           
protected  long getTtr()
           
protected  boolean isRefreshing()
           
 void run()
          Thread operation cycle
protected  void setRefreshing(boolean isRefreshing)
           
protected  void setTtr(long ttr)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheRefresher

public CacheRefresher(long ttr,
                      SrvRegistry registry)
               throws java.lang.Exception
Public constructor

Parameters:
ttr - ttr
registry - SrvRegistry instance
Throws:
java.lang.Exception - in case of error
Method Detail

run

public void run()
Thread operation cycle

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setRefreshing

protected void setRefreshing(boolean isRefreshing)
Parameters:
isRefreshing - the isRefreshing to set

isRefreshing

protected boolean isRefreshing()
Returns:
the isRefreshing

setTtr

protected void setTtr(long ttr)
Parameters:
ttr - the ttr to set

getTtr

protected long getTtr()
Returns:
the ttr

getRefreshCycleTime

protected long getRefreshCycleTime()
Returns:
the refreshCycleTime

getLastRefreshDate

protected java.util.Date getLastRefreshDate()
Returns:
the lastRefreshDate