类 ThreadLocalTaskFactory
java.lang.Object
com.github.myzhan.locust4j.AbstractTask
com.github.myzhan.locust4j.taskfactory.AbstractTaskFactory
com.github.myzhan.locust4j.taskfactory.ThreadLocalTaskFactory
- 所有已实现的接口:
Runnable
- 从以下版本开始:
- 1.0.13
ThreadLocalTaskFactory is a implementation of AbstractTaskFactory.
Because
Locust.run(AbstractTask...)only accepts instances of AbstractTask and uses them across threads, the implementation of AbstractTask must be thread-safe. It's not easy if we want to keep some thread-local fields, like tcp connections. Now, we can use ThreadLocalTaskFactory. Instances of AbstractTask are created after the creation of ThreadPool and made thread-local, so the implementation of AbstractTask can keep some thread-local fields. - 作者:
- myzhan
-
构造器概要
构造器 -
方法概要
从类继承的方法 com.github.myzhan.locust4j.taskfactory.AbstractTaskFactory
createTask从类继承的方法 com.github.myzhan.locust4j.AbstractTask
getName, getWeight, run
-
构造器详细资料
-
ThreadLocalTaskFactory
public ThreadLocalTaskFactory()
-
-
方法详细资料
-
onStart
public void onStart()从类复制的说明:AbstractTaskThis method will be executed once before the test loop. By default, nothing will be executed.- 覆盖:
onStart在类中AbstractTask
-
execute
从类复制的说明:AbstractTaskTest scenarios should be implemented in this method, like sending http request.- 指定者:
execute在类中AbstractTask- 抛出:
Exception- test scenarios may throw exception.
-
onStop
public void onStop()从类复制的说明:AbstractTaskThis method will be executed once after the test loop stopped, whether it ends in failure or not. By default, nothing will be executed- 覆盖:
onStop在类中AbstractTask
-