类 ThreadLocalTaskFactory

所有已实现的接口:
Runnable

public abstract class ThreadLocalTaskFactory extends AbstractTaskFactory
从以下版本开始:
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
  • 构造器详细资料

    • ThreadLocalTaskFactory

      public ThreadLocalTaskFactory()
  • 方法详细资料

    • onStart

      public void onStart()
      从类复制的说明: AbstractTask
      This method will be executed once before the test loop. By default, nothing will be executed.
      覆盖:
      onStart 在类中 AbstractTask
    • execute

      public void execute() throws Exception
      从类复制的说明: AbstractTask
      Test scenarios should be implemented in this method, like sending http request.
      指定者:
      execute 在类中 AbstractTask
      抛出:
      Exception - test scenarios may throw exception.
    • onStop

      public void onStop()
      从类复制的说明: AbstractTask
      This 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