Package com.caplin.motif.datasource
Interface CachedDataProvider<T extends SubjectInfo>
-
- Type Parameters:
T
- The type of subject info that will be provided with requests and discards.
- All Known Subinterfaces:
CachedMessageProvider<T>
- All Known Implementing Classes:
StrategyDetailsProvider
public interface CachedDataProvider<T extends SubjectInfo>
A DataProvider which receives a single
onRequest(SubjectInfo)
and a singleonDiscard(SubjectInfo)
, even if requests are made from multiple peers. A cache is kept for subscriptions and also records so that any subsequent peer request after an initial request will receive the current state of the message before another update is sent.In conjunction with a
SubjectParser
, each request and discard will be provided a parsed object that represents the subject.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onDiscard(T subject)
Called when the last peer subscribed discards the subject.void
onRequest(T subject)
Called on the initial request when the first peer makes a request.
-
-
-
Method Detail
-
onRequest
void onRequest(T subject)
Called on the initial request when the first peer makes a request.- Parameters:
subject
- The subject that was requested.
-
onDiscard
void onDiscard(T subject)
Called when the last peer subscribed discards the subject.- Parameters:
subject
- The subject that was discarded.
-
-