Class ChildObserver<I extends TopLevelItem>

java.lang.Object
com.cloudbees.hudson.plugins.folder.computed.ChildObserver<I>
All Implemented Interfaces:
AutoCloseable

public abstract class ChildObserver<I extends TopLevelItem> extends Object implements AutoCloseable
Callback for ComputedFolder. Methods may be called only inside the scope of ComputedFolder.computeChildren(com.cloudbees.hudson.plugins.folder.computed.ChildObserver<I>, hudson.model.TaskListener) or an out-of-band event handler.
See Also:
  • Method Details

    • shouldUpdate

      @CheckForNull public abstract I shouldUpdate(String name) throws InterruptedException
      Checks whether there is an existing child which should be updated. It is strongly recommended to call completed(String) after completion of processing the proposed Item.getName() as otherwise no other ChildObserver will be able to proceed with this Item.getName().
      Parameters:
      name - a proposed Item.getName()
      Returns:
      the existing child to update, if there is one (in which case go ahead and update it as needed); else null, in which case continue by checking mayCreate(java.lang.String)
      Throws:
      InterruptedException - if interrupted.
    • mayCreate

      public abstract boolean mayCreate(String name)
      Checks whether we may create a new child of the given name.
      Parameters:
      name - a proposed Item.getName()
      Returns:
      true if you may go ahead and call created(I) (though you are not obliged to do so); false if you may not
    • created

      public abstract void created(I child)
      Notify the observer that you did create a new child.
      Parameters:
      child - a newly constructed child item; do not call Item.onCreatedFromScratch() and try to avoid calls to Item.save()
    • completed

      public abstract void completed(String name)
      Notify the observer that you have completed with the named child and other threads are now permitted to proceed with observations of the Item.getName().
      Parameters:
      name - the Item.getName().
      Since:
      6.0.0
    • observed

      public abstract Set<String> observed()
      Returns a copy of the item names that have been observed.
      Returns:
      a copy of the item names that have been observed.
      Since:
      5.14
    • orphaned

      public abstract Map<String,I> orphaned()
      Returns a copy of the map of orphaned items keyed by name.
      Returns:
      a copy of the map of orphaned items keyed by name.
      Since:
      5.14
    • close

      public abstract void close()
      Closes the ChildObserver completing any observations that were not completed(String). This method is idempotent.
      Specified by:
      close in interface AutoCloseable