/**
   * @see
   *     com.crash4j.engine.spi.spi.traits.LifecycleHandler#exit(com.crash4j.engine.spi.resources.spi.ResourceSpi,
   *     java.lang.Object, java.lang.Object, java.lang.Object, long)
   */
  @Override
  public void exit(
      ResourceSpi spi,
      ResourceSpec spec,
      Object args,
      Object instance,
      Object rv,
      ResourceClosure c,
      Object ex,
      long testStartTime,
      long actualDt,
      long dt) {
    super.exit(spi, spec, args, instance, rv, c, ex, testStartTime, actualDt, dt);
    Action action = this.getAction(spi, spec, args, instance, c);
    if (action == null) {
      return;
    }
    StatsManager sMgr = ResourceManagerSpi.getStatsManager();
    sMgr.submit(spi, StatTypes.THROUGHPUT, UnitTypes.MICROSECONDS, action, dt, 1);

    // Get the instance of protocol recognizer
    ProtocolRecognizer pr = (ProtocolRecognizer) c.getData(ActionClasses.PROTOCOL.ordinal());
    if (ex != null) {
      ResourceManagerSpi.raiseProtocolEvent(pr.onError(spi, (Exception) ex));
    } else {
      byte[] b = new byte[1];
      b[0] = ((Integer) ArrayUtil.get(args, 0)).byteValue();
      ResourceManagerSpi.raiseProtocolEvent(pr.afterWrite(spi, b, 0, 1, 1));
    }
  }
 /**
  * @see
  *     com.crash4j.engine.spi.spi.traits.LifecycleHandler#exit(com.crash4j.engine.spi.resources.spi.ResourceSpi,
  *     java.lang.Object, java.lang.Object, java.lang.Object, long)
  */
 @Override
 public void exit(
     ResourceSpi spi,
     ResourceSpec spec,
     Object args,
     Object instance,
     Object rv,
     ResourceClosure c,
     Object ex,
     long testStartTime,
     long actualDt,
     long dt) {
   super.exit(spi, spec, args, instance, rv, c, ex, testStartTime, actualDt, dt);
   Action action = this.getAction(spi, spec, args, instance, c);
   if (action == null) {
     return;
   }
   StatsManager sMgr = ResourceManagerSpi.getStatsManager();
   byte[] b = (byte[]) ArrayUtil.get(args, 0);
   sMgr.submit(spi, StatTypes.THROUGHPUT, UnitTypes.MICROSECONDS, action, dt, b.length);
 }