code: @Override
      public final void complete(Object res, Object error) {
          this.result = res;
          Object prevErr = this.error;
          this.error = error;
          while( !lock.compareAndSet(false,true) ) {}
          try {
              if (hadResult) {
                  if ( prevErr instanceof Timeout ) {
                      this.error = prevErr;
                      lock.set(false);
                      return;
                  }
                  lock.set(false);
                  throw new RuntimeException("Double result received on future prevErr:" + prevErr +" (res,err) "+res+","+error );
              }
              hadResult = true;
              if (resultReceiver != null) {
                  if (hasFired) {
                      lock.set(false);
                      throw new RuntimeException("Double fire on callback");
                  }
                  hasFired = true;
                  lock.set(false);
                  resultReceiver.complete(result, error);
                  resultReceiver = null;
                  while (!lock.compareAndSet(false, true)) {
                  }
                  if (nextFuture != null) {
                      lock.set(false);
                      nextFuture.complete(result, error);
                  }
                  return;
              }
          } finally {
              lock.set(false);
          }
      }
docs: see IPromise (inheriting Callback) interface