Package xal.extension.service
Class RemoteDataCache<T>
java.lang.Object
xal.extension.service.RemoteDataCache<T>
RemoteDataCache is a utility for managing calls to remote services to avoid
deadlock if a service is down.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected xal.extension.service.RemoteData<T>
latest data that has been cached -
Constructor Summary
ConstructorsConstructorDescriptionRemoteDataCache
(Callable<T> remoteOperation) ConstructorRemoteDataCache
(Callable<T> remoteOperation, UpdateListener updateHandler) Primary Constructor -
Method Summary
Modifier and TypeMethodDescriptionGet the timestamp of the last fetchget the update handlergetValue()
Fetch the value and cache it for future requestsboolean
determine whether the remote service is connectedvoid
refresh()
Refresh the cache with a fresh call to the remote unless a fetch is already pendingvoid
setUpdateListener
(UpdateListener handler) set the update handler which is called when the cache has been updated
-
Field Details
-
cachedData
latest data that has been cached
-
-
Constructor Details
-
RemoteDataCache
Constructor -
RemoteDataCache
Primary Constructor
-
-
Method Details
-
setUpdateListener
set the update handler which is called when the cache has been updated -
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
Get the timestamp of the last fetch -
getValue
Fetch the value and cache it for future requests -
isConnected
public boolean isConnected()determine whether the remote service is connected
-