mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
added another convenience method.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5118 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
08babbd8fd
commit
795b6732c5
1 file changed
+11
@@ -5,6 +5,8 @@ import hudson.Functions;
|
||||
import hudson.remoting.Callable;
|
||||
import hudson.remoting.Channel;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.tasks.Publisher;
|
||||
import hudson.tasks.BuildWrapper;
|
||||
import hudson.util.DaemonThreadFactory;
|
||||
import hudson.util.RunList;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
@@ -356,4 +358,13 @@ public abstract class Computer extends AbstractModelObject {
|
||||
((Channel)getChannel()).dumpExportTable(w);
|
||||
w.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current {@link Computer} that the build is running.
|
||||
* This method only works when called during a build, such as by
|
||||
* {@link Publisher}, {@link BuildWrapper}, etc.
|
||||
*/
|
||||
public static Computer currentComputer() {
|
||||
return Executor.currentExecutor().getOwner();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user