Class ChildObserver<I extends TopLevelItem>
java.lang.Object
com.cloudbees.hudson.plugins.folder.computed.ChildObserver<I>
- All Implemented Interfaces:
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.-
Method Summary
Modifier and TypeMethodDescriptionabstract void
close()
Closes theChildObserver
completing any observations that were notcompleted(String)
.abstract void
Notify the observer that you have completed with the named child and other threads are now permitted to proceed with observations of theItem.getName()
.abstract void
Notify the observer that you did create a new child.abstract boolean
Checks whether we may create a new child of the given name.observed()
Returns a copy of the item names that have been observed.orphaned()
Returns a copy of the map of orphaned items keyed by name.abstract I
shouldUpdate
(String name) Checks whether there is an existing child which should be updated.
-
Method Details
-
shouldUpdate
Checks whether there is an existing child which should be updated. It is strongly recommended to callcompleted(String)
after completion of processing the proposedItem.getName()
as otherwise no otherChildObserver
will be able to proceed with thisItem.getName()
.- Parameters:
name
- a proposedItem.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 checkingmayCreate(java.lang.String)
- Throws:
InterruptedException
- if interrupted.
-
mayCreate
Checks whether we may create a new child of the given name.- Parameters:
name
- a proposedItem.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
Notify the observer that you did create a new child.- Parameters:
child
- a newly constructed child item; do not callItem.onCreatedFromScratch()
and try to avoid calls toItem.save()
-
completed
Notify the observer that you have completed with the named child and other threads are now permitted to proceed with observations of theItem.getName()
.- Parameters:
name
- theItem.getName()
.- Since:
- 6.0.0
-
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
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 theChildObserver
completing any observations that were notcompleted(String)
. This method is idempotent.- Specified by:
close
in interfaceAutoCloseable
-