Class FixedRateSource<D>
java.lang.Object
de.iip_ecosphere.platform.services.environment.services.FixedRateSource<D>
- Type Parameters:
D- the data handled by the source
- Direct Known Subclasses:
FixedRateSource.TransportFixedRateSource
A fixed rate source for experiments. May be used in a service, may be used standalone.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA parameter/configuration object for theFixedRateSource.static classSpecializes the fixed-rate source forTransportConnector. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DataIngestor<D> private FixedRateSource.FixedRateParamsprivate Supplier<ServiceState> private Timer -
Constructor Summary
ConstructorsConstructorDescriptionFixedRateSource(Supplier<D> dataCreator, FixedRateSource.FixedRateParams params) Creates a fixed-rate source.FixedRateSource(Supplier<D> dataCreator, FixedRateSource.FixedRateParams params, DataIngestor<D> ingestor, Supplier<ServiceState> stateSupplier) Creates a fixed-rate source. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidCalled to disconnect from the ingestor.protected abstract booleanShall the run/experiment be started by this instance.protected voidIs called to ingest data provided bydataCreator.static <D> DataIngestor<D> Creates a no-ingestor that ignores data.protected abstract voidNotifies that data has been sent.protected abstract voidNotifies about starting the run/experiment.protected abstract voidNotifies about stopping the run/experiment.static Supplier<ServiceState> Creates a standard running state supplier.protected voidsetIngestor(DataIngestor<D> ingestor) Changes the ingestor.voidstart()Starts the source, if enabled starting/stopping the experiment.
-
Field Details
-
timer
-
dataCreator
-
params
-
ingestor
-
stateSupplier
-
-
Constructor Details
-
FixedRateSource
Creates a fixed-rate source.- Parameters:
dataCreator- a supplier creating the dataparams- the parameter/configuration object
-
FixedRateSource
public FixedRateSource(Supplier<D> dataCreator, FixedRateSource.FixedRateParams params, DataIngestor<D> ingestor, Supplier<ServiceState> stateSupplier) Creates a fixed-rate source.- Parameters:
dataCreator- a supplier creating the dataparams- the parameter/configuration objectingestor- data ingestorstateSupplier- service state supplier
-
-
Method Details
-
noIngestor
Creates a no-ingestor that ignores data.- Type Parameters:
D- the type of data- Returns:
- the ingestor
-
runningState
Creates a standard running state supplier.- Returns:
- the supplier
-
setIngestor
Changes the ingestor.- Parameters:
ingestor- the new ingestor
-
start
public void start()Starts the source, if enabled starting/stopping the experiment. -
doStartExperiment
protected abstract boolean doStartExperiment()Shall the run/experiment be started by this instance.- Returns:
truefor starting,falsefor not starting
-
notifyStarting
protected abstract void notifyStarting()Notifies about starting the run/experiment. -
notifyStopping
protected abstract void notifyStopping()Notifies about stopping the run/experiment. -
notifySent
protected abstract void notifySent()Notifies that data has been sent. -
ingest
Is called to ingest data provided bydataCreator.- Parameters:
data- the data- Throws:
IOException- if ingesting fails
-
disconnect
Called to disconnect from the ingestor.- Throws:
IOException- if disconnecting fails
-