Class RemoteDataCache<T>

java.lang.Object
xal.extension.service.RemoteDataCache<T>

public class RemoteDataCache<T> extends Object
RemoteDataCache is a utility for managing calls to remote services to avoid deadlock if a service is down.
  • Field Details

    • cachedData

      protected volatile xal.extension.service.RemoteData<T> cachedData
      latest data that has been cached
  • Constructor Details

    • RemoteDataCache

      public RemoteDataCache(Callable<T> remoteOperation)
      Constructor
    • RemoteDataCache

      public RemoteDataCache(Callable<T> remoteOperation, UpdateListener updateHandler)
      Primary Constructor
  • Method Details

    • setUpdateListener

      public void setUpdateListener(UpdateListener handler)
      set the update handler which is called when the cache has been updated
    • getUpdateListener

      public UpdateListener getUpdateListener()
      get the update handler
    • refresh

      public void refresh()
      Refresh the cache with a fresh call to the remote unless a fetch is already pending
    • getTimestamp

      public Date getTimestamp()
      Get the timestamp of the last fetch
    • getValue

      public T getValue()
      Fetch the value and cache it for future requests
    • isConnected

      public boolean isConnected()
      determine whether the remote service is connected