diff --git a/pom.xml b/pom.xml
index 2f34cbc..1c02d1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
org.jenkins-ci.plugins
plugin
- 1.565.3
+ 1.625.3
gearman-plugin
diff --git a/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java b/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
index 7409b00..18bf100 100644
--- a/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
+++ b/src/main/java/hudson/plugins/gearman/ExecutorWorkerThread.java
@@ -117,7 +117,7 @@ public class ExecutorWorkerThread extends AbstractWorkerThread{
if (!computer.isOffline()) {
Node node = computer.getNode();
- List allProjects = Jenkins.getInstance().getAllItems(AbstractProject.class);
+ List allProjects = Jenkins.getActiveInstance().getAllItems(AbstractProject.class);
for (AbstractProject, ?> project : allProjects) {
if (project.isDisabled()) { // ignore all disabled projects
diff --git a/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java b/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
index 4f35d84..e16e315 100644
--- a/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
+++ b/src/main/java/hudson/plugins/gearman/GearmanPluginUtil.java
@@ -51,7 +51,7 @@ public class GearmanPluginUtil {
*/
public static String getRealName(Computer computer) {
- if (Computer.currentComputer() == computer) {
+ if (Jenkins.getActiveInstance().getComputer("") == computer) {
return "master";
} else {
return computer.getName();
@@ -70,7 +70,7 @@ public class GearmanPluginUtil {
*/
public static Run,?> findBuild(String jobName, int buildNumber) {
- AbstractProject,?> project = Jenkins.getInstance().getItemByFullName(jobName, AbstractProject.class);
+ AbstractProject,?> project = Jenkins.getActiveInstance().getItemByFullName(jobName, AbstractProject.class);
if (project != null){
Run,?> run = project.getBuildByNumber(buildNumber);
if (run != null) {
diff --git a/src/main/java/hudson/plugins/gearman/GearmanProxy.java b/src/main/java/hudson/plugins/gearman/GearmanProxy.java
index 38f3360..26935e8 100644
--- a/src/main/java/hudson/plugins/gearman/GearmanProxy.java
+++ b/src/main/java/hudson/plugins/gearman/GearmanProxy.java
@@ -70,7 +70,7 @@ public class GearmanProxy {
String hostname = Constants.GEARMAN_DEFAULT_EXECUTOR_NAME;
// query Jenkins for master's name
try {
- master = Jenkins.getInstance().getComputer("");
+ master = Jenkins.getActiveInstance().getComputer("");
hostname = master.getHostName();
} catch (Exception e) {
logger.warn("Exception while getting hostname", e);
@@ -119,7 +119,7 @@ public class GearmanProxy {
// first make sure master is enabled (or has executors)
Node masterNode = null;
try {
- masterNode = Computer.currentComputer().getNode();
+ masterNode = Jenkins.getActiveInstance().getComputer("").getNode();
} catch (NullPointerException npe) {
logger.info("---- Master is offline");
} catch (Exception e) {
@@ -136,7 +136,7 @@ public class GearmanProxy {
/*
* Spawn executors for the jenkins slaves
*/
- List nodes = Jenkins.getInstance().getNodes();
+ List nodes = Jenkins.getActiveInstance().getNodes();
if (!nodes.isEmpty()) {
for (Node node : nodes) {
Computer computer = node.toComputer();
diff --git a/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java b/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
index 24f3f66..96b6aae 100644
--- a/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
+++ b/src/main/java/hudson/plugins/gearman/NodeAvailabilityMonitor.java
@@ -38,7 +38,7 @@ public class NodeAvailabilityMonitor implements AvailabilityMonitor {
{
this.computer = computer;
queue = Queue.getInstance();
- jenkins = Jenkins.getInstance();
+ jenkins = Jenkins.getActiveInstance();
}
public Computer getComputer() {
diff --git a/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java b/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
index 7382b10..f403387 100644
--- a/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
+++ b/src/test/java/hudson/plugins/gearman/GearmanPluginConfigTest.java
@@ -48,7 +48,7 @@ public class GearmanPluginConfigTest {
public void setUp() {
Jenkins jenkins = mock(Jenkins.class);
PowerMockito.mockStatic(Jenkins.class);
- when(Jenkins.getInstance()).thenReturn(jenkins);
+ when(Jenkins.getActiveInstance()).thenReturn(jenkins);
gpc = new GearmanPluginConfig();
}
diff --git a/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java b/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
index 0f5a269..486efd6 100644
--- a/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
+++ b/src/test/java/hudson/plugins/gearman/GearmanPluginUtilTest.java
@@ -20,6 +20,7 @@ package hudson.plugins.gearman;
import hudson.model.Computer;
import hudson.slaves.DumbSlave;
+import jenkins.model.Jenkins;
import org.junit.Test;
import org.jvnet.hudson.test.HudsonTestCase;
@@ -45,7 +46,7 @@ public class GearmanPluginUtilTest extends HudsonTestCase {
@Test
public void testGetRealNameMaster() throws Exception {
- assertEquals("master", GearmanPluginUtil.getRealName(Computer.currentComputer()));
+ assertEquals("master", GearmanPluginUtil.getRealName(Jenkins.getActiveInstance().getComputer("")));
}
}