operator/src/main/java/oracle/kubernetes/operator/work/Fiber.java
@Override
  public boolean cancel(boolean mayInterrupt) {
    if (!status.compareAndSet(NOT_COMPLETE, CANCELLED)) {
      return false;
    }

    if (LOGGER.isFinerEnabled()) {
      LOGGER.finer("{0} cancelled", getName());
    }

    // synchronized(this) is used as Thread running Fiber will be holding lock
    synchronized (this) {
      if (mayInterrupt) {
        if (currentThread != null) {
          currentThread.interrupt();
        }
      }

      if (children != null) {
        for (Fiber child : children) {
          child.cancel(mayInterrupt);
        }
      }

      recordBreadCrumb();
    }

    return true;
  }
/**
   * Marks this Fiber as cancelled. A cancelled Fiber will never invoke its completion callback
   *
   * @param mayInterrupt if cancel should use {@link Thread#interrupt()}
   * @see java.util.concurrent.Future#cancel(boolean)
   */
Marks this Fiber as cancelled. A cancelled Fiber will never invoke its completion callback
@param mayInterrupt if cancel should use  Thread#interrupt()
@see java.util.concurrent.Future#cancel(boolean)
Marks this Fiber as cancelled . A cancelled Fiber will never invoke its completion callback @param mayInterrupt if cancel should use Thread#interrupt () @see java . util . concurrent . Future#cancel ( boolean )
@Override
  public boolean cancel(boolean mayInterrupt) {
    if (!status.compareAndSet(NOT_COMPLETE, CANCELLED)) {
      return false;
    }
    if (LOGGER.isFinerEnabled()) {
      LOGGER.finer("{0} cancelled", getName());
    }
    synchronized (this) {
      if (mayInterrupt) {
        if (currentThread != null) {
          currentThread.interrupt();
        }
      }
      if (children != null) {
        for (Fiber child : children) {
          child.cancel(mayInterrupt);
        }
      }
      recordBreadCrumb();
    }
    return true;
  }
@ Override public boolean cancel ( boolean mayInterrupt ) { if ( ! status . compareAndSet ( NOT_COMPLETE , CANCELLED ) ) { return false ; } if ( LOGGER . isFinerEnabled ( ) ) { LOGGER . finer ( "{0} cancelled" , getName ( ) ) ; } synchronized ( this ) { if ( mayInterrupt ) { if ( currentThread != null ) { currentThread . interrupt ( ) ; } } if ( children != null ) { for ( Fiber child : children ) { child . cancel ( mayInterrupt ) ; } } recordBreadCrumb ( ) ; } return true ; }
Marks this Fiber as cancelled.
Marks this Fiber as cancelled .
// synchronized(this) is used as Thread running Fiber will be holding lock