mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
added the all method to follow the convention.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15696 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
c1afe8eb6a
commit
185a90e408
1 file changed
+10
-2
@@ -27,6 +27,7 @@ import hudson.model.Computer;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.ExtensionPoint;
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionList;
|
||||
|
||||
/**
|
||||
* Receives notifications about status changes of {@link Computer}s.
|
||||
@@ -52,7 +53,7 @@ public abstract class ComputerListener implements ExtensionPoint {
|
||||
* put {@link Extension} on your class to have it auto-registered.
|
||||
*/
|
||||
public final void register() {
|
||||
Hudson.getInstance().getExtensionList(ComputerListener.class).add(this);
|
||||
all().add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,6 +63,13 @@ public abstract class ComputerListener implements ExtensionPoint {
|
||||
* Unless {@link ComputerListener} is unregistered, it will never be a subject of GC.
|
||||
*/
|
||||
public final boolean unregister() {
|
||||
return Hudson.getInstance().getExtensionList(ComputerListener.class).remove(this);
|
||||
return all().remove(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* All the registered {@link ComputerListener}s.
|
||||
*/
|
||||
public static ExtensionList<ComputerListener> all() {
|
||||
return Hudson.getInstance().getExtensionList(ComputerListener.class);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user