Class AbstractSimDataChannelResource
- java.lang.Object
-
- org.palladiosimulator.indirections.scheduler.AbstractSimDataChannelResource
-
- All Implemented Interfaces:
IDataChannelResource
- Direct Known Subclasses:
AbstractAnyToAllChannel
,AnyToAllPushingDataChannelWithRDs
,D2_WindowedReadingRepartitioning
,D4_MedianWindowing
,D6_Joining
,D6_JoiningToGroup
,SlidingWindowChannel
public abstract class AbstractSimDataChannelResource extends Object implements IDataChannelResource
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AbstractSimDataChannelResource(DataChannel dataChannel, org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext, org.palladiosimulator.simulizar.interpreter.InterpreterDefaultContext mainContext, de.uka.ipd.sdq.scheduler.SchedulerModel model, org.palladiosimulator.simulizar.di.component.interfaces.SimulatedThreadComponent.Factory simulatedThreadComponentFactory, DataChannelResourceRegistry dataChannelResourceRegistry)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
acceptData(DataSinkRole role, IndirectionDate date)
void
advance(double watermarkTime)
protected void
blockUntilCanGet(ProcessWaitingToGet process)
protected void
blockUntilCanPut(ProcessWaitingToPut process)
protected abstract boolean
canAcceptData(DataSinkRole role)
protected abstract boolean
canProvideData(DataSourceRole role)
protected void
continueWithoutData(ProcessWaitingToGet process)
protected void
discardDataAndContinue(ProcessWaitingToPut process)
protected boolean
discardDateIfTooOld(IndirectionDate dateToDiscard)
If so, this method returns true and measurements about the discarding are recorded.protected void
discardIncomingDate(IndirectionDate dateToDiscard)
boolean
get(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, DataSourceRole role, Consumer<IndirectionDate> callback)
double
getCurrentWatermarkedTime()
String
getId()
Unique identifier of the resource.String
getName()
Name of the resource.protected abstract void
handleCannotProceedToGet(ProcessWaitingToGet process)
protected abstract void
handleCannotProceedToPut(ProcessWaitingToPut process)
protected abstract void
handleNewWatermarkedTime(double oldWatermarkTime, double watermarkTime)
protected boolean
isDateTooOld(IndirectionDate date)
Finds out whether ALL data in dateToDiscard is too old for this channel.protected abstract boolean
isPushingRole(DataSourceRole role)
protected void
notifyProcessesCanGetNewData()
protected void
notifyProcessesCanPutNewData()
protected void
processDataAvailableToGet()
protected abstract void
provideDataAndAdvance(DataSourceRole role, Consumer<IndirectionDate> continuation)
It must hold that#provideDataAndAdvance(DataChannelSourceConnector)
can be called iff#canProvideData(DataChannelSourceConnector)
was true immediately before the call.boolean
put(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, DataSinkRole role, IndirectionDate date)
protected void
scheduleAdvance(double firstOccurence, double delay, double lagBehindRealTime)
protected void
scheduleDemand(String resourceTypeId, String demandSpecification, IndirectionDate date, Consumer<IndirectionDate> andThen)
Schedules the given demand on the given resource type.protected void
unscheduleAdvance()
-
-
-
Field Detail
-
afterAcceptingAgeCalculator
protected TriggerableTimeSpanCalculator afterAcceptingAgeCalculator
-
beforeProvidingAgeCalculator
protected TriggerableTimeSpanCalculator beforeProvidingAgeCalculator
-
dataChannel
protected DataChannel dataChannel
-
discardedAgeCalculator
protected TriggerableTimeSpanCalculator discardedAgeCalculator
-
id
protected String id
-
model
protected de.uka.ipd.sdq.simucomframework.model.SimuComModel model
-
name
protected String name
-
numberOfDiscardedIncomingElementsCalculator
protected TriggerableCountingCalculator numberOfDiscardedIncomingElementsCalculator
-
numberOfDiscardedOutgoingElementsCalculator
protected TriggerableCountingCalculator numberOfDiscardedOutgoingElementsCalculator
-
numberOfStoredIncomingElementsCalculator
protected TriggerableCountingCalculator numberOfStoredIncomingElementsCalculator
-
numberOfStoredOutgoingElementsCalculator
protected TriggerableCountingCalculator numberOfStoredOutgoingElementsCalculator
-
processesWaitingToGet
protected Map<DataSourceRole,Queue<ProcessWaitingToGet>> processesWaitingToGet
-
processesWaitingToPut
protected Map<DataSinkRole,Queue<ProcessWaitingToPut>> processesWaitingToPut
-
waitingToGetTimeCalculator
protected ContextAwareTimeSpanCalculator<ProcessWaitingToGet> waitingToGetTimeCalculator
-
waitingToPutTimeCalculator
protected ContextAwareTimeSpanCalculator<ProcessWaitingToPut> waitingToPutTimeCalculator
-
resourceTableManager
protected final de.uka.ipd.sdq.scheduler.resources.active.IResourceTableManager resourceTableManager
-
assemblyContext
protected final org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext
-
simulatedThreadComponentFactory
protected final org.palladiosimulator.simulizar.di.component.interfaces.SimulatedThreadComponent.Factory simulatedThreadComponentFactory
-
mainContext
protected final org.palladiosimulator.simulizar.interpreter.InterpreterDefaultContext mainContext
-
dataChannelResourceRegistry
protected final DataChannelResourceRegistry dataChannelResourceRegistry
-
-
Constructor Detail
-
AbstractSimDataChannelResource
public AbstractSimDataChannelResource(DataChannel dataChannel, org.palladiosimulator.pcm.core.composition.AssemblyContext assemblyContext, org.palladiosimulator.simulizar.interpreter.InterpreterDefaultContext mainContext, de.uka.ipd.sdq.scheduler.SchedulerModel model, org.palladiosimulator.simulizar.di.component.interfaces.SimulatedThreadComponent.Factory simulatedThreadComponentFactory, DataChannelResourceRegistry dataChannelResourceRegistry)
-
-
Method Detail
-
acceptData
protected abstract void acceptData(DataSinkRole role, IndirectionDate date)
-
advance
public void advance(double watermarkTime)
- Specified by:
advance
in interfaceIDataChannelResource
-
blockUntilCanGet
protected void blockUntilCanGet(ProcessWaitingToGet process)
-
blockUntilCanPut
protected void blockUntilCanPut(ProcessWaitingToPut process)
-
canAcceptData
protected abstract boolean canAcceptData(DataSinkRole role)
-
canProvideData
protected abstract boolean canProvideData(DataSourceRole role)
-
continueWithoutData
protected void continueWithoutData(ProcessWaitingToGet process)
-
discardDataAndContinue
protected void discardDataAndContinue(ProcessWaitingToPut process)
-
discardIncomingDate
protected void discardIncomingDate(IndirectionDate dateToDiscard)
-
discardDateIfTooOld
protected boolean discardDateIfTooOld(IndirectionDate dateToDiscard)
If so, this method returns true and measurements about the discarding are recorded.
-
isDateTooOld
protected boolean isDateTooOld(IndirectionDate date)
Finds out whether ALL data in dateToDiscard is too old for this channel.
-
scheduleDemand
protected void scheduleDemand(String resourceTypeId, String demandSpecification, IndirectionDate date, Consumer<IndirectionDate> andThen)
Schedules the given demand on the given resource type. This postpones the continued execution.The demand is scheduled on the resource this data channel is allocated on.
- Parameters:
resourceType
- the type of resourcedemandSpecification
- a StoEx as String
-
get
public boolean get(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, DataSourceRole role, Consumer<IndirectionDate> callback)
- Specified by:
get
in interfaceIDataChannelResource
-
isPushingRole
protected abstract boolean isPushingRole(DataSourceRole role)
-
getCurrentWatermarkedTime
public double getCurrentWatermarkedTime()
-
getId
public String getId()
Description copied from interface:IDataChannelResource
Unique identifier of the resource.- Specified by:
getId
in interfaceIDataChannelResource
- Returns:
-
getName
public String getName()
Description copied from interface:IDataChannelResource
Name of the resource.- Specified by:
getName
in interfaceIDataChannelResource
- Returns:
-
handleCannotProceedToGet
protected abstract void handleCannotProceedToGet(ProcessWaitingToGet process)
-
handleCannotProceedToPut
protected abstract void handleCannotProceedToPut(ProcessWaitingToPut process)
-
handleNewWatermarkedTime
protected abstract void handleNewWatermarkedTime(double oldWatermarkTime, double watermarkTime)
-
notifyProcessesCanGetNewData
protected void notifyProcessesCanGetNewData()
-
notifyProcessesCanPutNewData
protected void notifyProcessesCanPutNewData()
-
processDataAvailableToGet
protected void processDataAvailableToGet()
-
provideDataAndAdvance
protected abstract void provideDataAndAdvance(DataSourceRole role, Consumer<IndirectionDate> continuation)
It must hold that#provideDataAndAdvance(DataChannelSourceConnector)
can be called iff#canProvideData(DataChannelSourceConnector)
was true immediately before the call.Calling
#provideDataAndAdvance(DataChannelSourceConnector)
in a loop must eventually lead to#canProvideData(DataChannelSourceConnector)
returningfalse
.
-
put
public boolean put(de.uka.ipd.sdq.scheduler.ISchedulableProcess schedulableProcess, DataSinkRole role, IndirectionDate date)
- Specified by:
put
in interfaceIDataChannelResource
-
scheduleAdvance
protected void scheduleAdvance(double firstOccurence, double delay, double lagBehindRealTime)
-
unscheduleAdvance
protected void unscheduleAdvance()
-
-