Package io.hyperfoil.api.session
Interface Session
-
- All Superinterfaces:
java.util.concurrent.Callable<java.lang.Void>
public interface Session extends java.util.concurrent.Callable<java.lang.Void>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classSession.ConcurrencyPolicyBehaviour when a new sequence start is requested but the concurrency factor is exceeded.static interfaceSession.Resourcestatic interfaceSession.ResourceKey<R extends Session.Resource>static interfaceSession.Varstatic classSession.VarType
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intagentId()intagents()intagentThreadId()intagentThreads()voidattach(io.netty.util.concurrent.EventExecutor executor, SharedData sharedData, SessionStatistics statistics)RequestcurrentRequest()voidcurrentRequest(Request request)SequenceInstancecurrentSequence()voidcurrentSequence(SequenceInstance current)<R extends Session.Resource>
voiddeclareResource(Session.ResourceKey<R> key, java.util.function.Supplier<R> resourceSupplier)<R extends Session.Resource>
voiddeclareResource(Session.ResourceKey<R> key, java.util.function.Supplier<R> resourceSupplier, boolean singleton)Reserve space in the session for a resource, stored under given key.<R extends Session.Resource>
voiddeclareSingletonResource(Session.ResourceKey<R> key, R resource)io.netty.util.concurrent.EventExecutorexecutor()voidfail(java.lang.Throwable t)<R extends Session.Resource>
RgetResource(Session.ResourceKey<R> key)intglobalThreadId()intglobalThreads()booleanisActive()PhaseInstancephase()longphaseStartTimestamp()voidproceed()Run anything that can be executed.voidpruneStats(Phase phase)voidreserve(Scenario scenario)voidreset()java.lang.StringrunId()SharedDatasharedData()voidstart(PhaseInstance phase)SequenceInstancestartSequence(java.lang.String name, boolean forceSameIndex, Session.ConcurrencyPolicy policy)Statisticsstatistics(int stepId, java.lang.String name)voidstop()intuniqueId()
-
-
-
Method Detail
-
reserve
void reserve(Scenario scenario)
-
uniqueId
int uniqueId()
- Returns:
- int >= 0 that's unique across whole simulation
-
agentThreadId
int agentThreadId()
-
agentThreads
int agentThreads()
-
globalThreadId
int globalThreadId()
-
globalThreads
int globalThreads()
-
agentId
int agentId()
-
agents
int agents()
-
runId
java.lang.String runId()
-
executor
io.netty.util.concurrent.EventExecutor executor()
-
sharedData
SharedData sharedData()
-
phase
PhaseInstance phase()
-
phaseStartTimestamp
long phaseStartTimestamp()
-
statistics
Statistics statistics(int stepId, java.lang.String name)
-
pruneStats
void pruneStats(Phase phase)
-
declareResource
<R extends Session.Resource> void declareResource(Session.ResourceKey<R> key, java.util.function.Supplier<R> resourceSupplier)
- Type Parameters:
R- Resource type.- Parameters:
key- Unique key (usually the step or handler itself)resourceSupplier- Supplier creating the resource, possible multiple times.
-
declareResource
<R extends Session.Resource> void declareResource(Session.ResourceKey<R> key, java.util.function.Supplier<R> resourceSupplier, boolean singleton)
Reserve space in the session for a resource, stored under given key. If this is executed within asequencewith non-zeroconcurrencythe session stores one resource for each concurrent instance. If this behaviour should be avoided setsingletonto true.- Type Parameters:
R- Resource type.- Parameters:
key- Unique key (usually the step or handler itself)resourceSupplier- Supplier creating the resource, possible multiple times.singleton- Is the resource shared amongst concurrent sequences?
-
declareSingletonResource
<R extends Session.Resource> void declareSingletonResource(Session.ResourceKey<R> key, R resource)
-
getResource
<R extends Session.Resource> R getResource(Session.ResourceKey<R> key)
-
currentSequence
void currentSequence(SequenceInstance current)
-
currentSequence
SequenceInstance currentSequence()
-
attach
void attach(io.netty.util.concurrent.EventExecutor executor, SharedData sharedData, SessionStatistics statistics)
-
start
void start(PhaseInstance phase)
-
proceed
void proceed()
Run anything that can be executed.
-
reset
void reset()
-
startSequence
SequenceInstance startSequence(java.lang.String name, boolean forceSameIndex, Session.ConcurrencyPolicy policy)
-
stop
void stop()
-
fail
void fail(java.lang.Throwable t)
-
isActive
boolean isActive()
-
currentRequest
Request currentRequest()
- Returns:
- Currently executed request, or
nullif not in scope.
-
currentRequest
void currentRequest(Request request)
-
-