Class Runners

java.lang.Object
com.iohao.net.framework.core.runner.Runners

public final class Runners extends Object
Manages the lifecycle of Runner instances registered with a BarSkeleton.

Runners are invoked in two phases:

  1. onStart() -- before the network connection is established.
  2. onStartAfter() -- after the network connection is established (delayed by one second).
Adding runners after onStart() has been called will throw an exception.
Author:
渔民小镇
See Also:
date:
2023-04-23
  • Constructor Details

    • Runners

      public Runners()
      Create a new instance and register internal runners.
  • Method Details

    • addRunner

      public void addRunner(Runner runner)
      Register a runner to be executed during the startup lifecycle.
      Parameters:
      runner - the runner to add (must not be null)
      Throws:
      RuntimeException - if runners have already been started
    • onStart

      public void onStart()
      Execute all runners' Runner.onStart(BarSkeleton) callbacks (idempotent).
    • onStartAfter

      public void onStartAfter()
      Execute all runners' Runner.onStartAfter(BarSkeleton) callbacks (idempotent, delayed).
    • listRunnerName

      public List<String> listRunnerName()
      Return the display names of all registered runners.
      Returns:
      list of runner names
    • getRunnerList

      public List<Runner> getRunnerList()
    • setBarSkeleton

      public void setBarSkeleton(BarSkeleton barSkeleton)