From 185a90e408990e73bb4e855fc825c4f827fdcba0 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 24 Feb 2009 23:32:41 +0000 Subject: [PATCH] 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 --- .../main/java/hudson/slaves/ComputerListener.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/slaves/ComputerListener.java b/core/src/main/java/hudson/slaves/ComputerListener.java index be4dfd7ae2..4d31399e93 100644 --- a/core/src/main/java/hudson/slaves/ComputerListener.java +++ b/core/src/main/java/hudson/slaves/ComputerListener.java @@ -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 all() { + return Hudson.getInstance().getExtensionList(ComputerListener.class); } } -- GitLab