org.gcube.opensearch.opensearchdatasource.cacherefresh
Class CacheRefresher

java.lang.Object
  extended by org.gcube.opensearch.opensearchdatasource.cacherefresh.CacheRefresher
All Implemented Interfaces:
java.lang.Runnable

public class CacheRefresher
extends java.lang.Object
implements java.lang.Runnable

In charge of refreshing the generic resource caches contained in the state WS resources of the OpenSearchDataSource. After purging a cache, the top-level generic resource is retrieved again from the IS and re-cached, ensuring that the service operates on up-to-date generic resources. All cached description documents contained in the caches are also purged from the caches. Depending on configuration, the refresh operation can be performed periodically on a configurable time interval in milliseconds. If the time interval is equal to 0, no periodic refresh cycles are performed. The cache can also be refreshed on demand, via the OpenSearchDataSource#refreshCache(org.gcube.opensearch.opensearchdatasource.stubs.RefreshCache) operation of its portType

Author:
gerasimos.farantatos, NKUA

Constructor Summary
CacheRefresher(long refreshIntervalMillis)
          Creates a new cache refresher
 
Method Summary
 void forceRefresh()
          Schedules a forced cache refresh to be performed as soon as possible The scheduled activation time of the next cache refresh cycle is not affected
 void run()
          Performs the periodic and forced cache refresh operations
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheRefresher

public CacheRefresher(long refreshIntervalMillis)
Creates a new cache refresher

Parameters:
refreshIntervalMillis - The time interval between cache refresh cycles, in milliseconds
Method Detail

run

public void run()
Performs the periodic and forced cache refresh operations

Specified by:
run in interface java.lang.Runnable

forceRefresh

public void forceRefresh()
Schedules a forced cache refresh to be performed as soon as possible The scheduled activation time of the next cache refresh cycle is not affected