code: @Override
    public <T> Task<T> synchronize(Task<T> task, long deadline) {
      return PlanLocal.get(getPlanLocalKey(), LockInternal.class)
          .flatMap(lockInternal -> {
            if (lockInternal != null) {
              // we already acquire the lock, add count only.
              lockInternal._lockCount++;
              return Task.value(lockInternal._lockNode);
            } else {
              // try acquire.
              return acquire(deadline);
            }
          })
          /* run the given task with toTry() */
          .flatMap(unused -> task).toTry()
          /* release the lock and unwind the result */
          .flatMap(result -> release().andThen(unwind(result)));
    }
docs: {@inheritDoc}