@Override
    public void onComplete() {
      if (done) {
        return;
      }
      done = true;
      try {
        onComplete.run();
      } catch (Throwable e) {
        onError(e);
        return;
      }

      actual.onComplete();

      try {
        onAfterTerminate.run();
      } catch (Throwable e) {
        RxJavaPlugins.onError(e);
      }
    }
    @Override
    public void onError(Throwable t) {
      if (done) {
        RxJavaPlugins.onError(t);
        return;
      }
      done = true;
      try {
        onError.accept(t);
      } catch (Throwable e) {
        t.addSuppressed(e);
      }
      actual.onError(t);

      try {
        onAfterTerminate.run();
      } catch (Throwable e) {
        RxJavaPlugins.onError(e);
      }
    }