docs: public int invoke()
      {
          int workCount = 0;
          if (isRunning)
          {
              try
              {
                  workCount = agent.doWork();
              }
              catch (final InterruptedException | ClosedByInterruptException ignore)
              {
                  close();
                  Thread.currentThread().interrupt();
              }
              catch (final AgentTerminationException ex)
              {
                  handleError(ex);
                  close();
              }
              catch (final Throwable throwable)
              {
                  handleError(throwable);
              }
          }
  
          return workCount;
      }