提交 185a90e4 编写于 作者: K kohsuke

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
上级 c1afe8eb
...@@ -27,6 +27,7 @@ import hudson.model.Computer; ...@@ -27,6 +27,7 @@ import hudson.model.Computer;
import hudson.model.Hudson; import hudson.model.Hudson;
import hudson.ExtensionPoint; import hudson.ExtensionPoint;
import hudson.Extension; import hudson.Extension;
import hudson.ExtensionList;
/** /**
* Receives notifications about status changes of {@link Computer}s. * Receives notifications about status changes of {@link Computer}s.
...@@ -52,7 +53,7 @@ public abstract class ComputerListener implements ExtensionPoint { ...@@ -52,7 +53,7 @@ public abstract class ComputerListener implements ExtensionPoint {
* put {@link Extension} on your class to have it auto-registered. * put {@link Extension} on your class to have it auto-registered.
*/ */
public final void register() { public final void register() {
Hudson.getInstance().getExtensionList(ComputerListener.class).add(this); all().add(this);
} }
/** /**
...@@ -62,6 +63,13 @@ public abstract class ComputerListener implements ExtensionPoint { ...@@ -62,6 +63,13 @@ public abstract class ComputerListener implements ExtensionPoint {
* Unless {@link ComputerListener} is unregistered, it will never be a subject of GC. * Unless {@link ComputerListener} is unregistered, it will never be a subject of GC.
*/ */
public final boolean unregister() { 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);
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册