Author: azeez Date: Tue Dec 21 14:09:55 2010 New Revision: 1051503 URL: http://svn.apache.org/viewvc?rev=1051503&view=rev Log: The configContext may not be set in all cases, hence was throwing an NPE. Now we are storing the DEPLOYMENT_TASK_RUNNING parameter in the AxisConfig
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=1051503&r1=1051502&r2=1051503&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/DeploymentEngine.java Tue Dec 21 14:09:55 2010 @@ -876,7 +876,7 @@ public abstract class DeploymentEngine i protected void startSearch(RepositoryListener listener) { scheduler = new Scheduler(); - schedulerTask = new SchedulerTask(listener, configContext); + schedulerTask = new SchedulerTask(listener, axisConfig); scheduler.schedule(schedulerTask, new DeploymentIterator()); } @@ -887,9 +887,14 @@ public abstract class DeploymentEngine i * @return true - if the deployment task is running, false - otherwise */ public boolean isDeploymentTaskRunning() { - Boolean deploymentTaskRunning = - (Boolean)configContext.getProperty(DeploymentEngine.DEPLOYMENT_TASK_RUNNING); - return deploymentTaskRunning != null && deploymentTaskRunning; + synchronized (axisConfig) { + Parameter deploymentTaskRunningParam = + axisConfig.getParameter(DeploymentEngine.DEPLOYMENT_TASK_RUNNING); + if (deploymentTaskRunningParam != null) { + return (Boolean) deploymentTaskRunningParam.getValue(); + } + return false; + } } public synchronized void unDeploy() { Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java?rev=1051503&r1=1051502&r2=1051503&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/scheduler/SchedulerTask.java Tue Dec 21 14:09:55 2010 @@ -20,9 +20,12 @@ package org.apache.axis2.deployment.scheduler; +import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.DeploymentEngine; import org.apache.axis2.deployment.RepositoryListener; +import org.apache.axis2.description.Parameter; +import org.apache.axis2.engine.AxisConfiguration; import java.util.TimerTask; @@ -33,14 +36,16 @@ public class SchedulerTask implements Ru int state = 0; TimerTask timerTask; private RepositoryListener wsListener; - private ConfigurationContext configCtx; + private AxisConfiguration axisConfig; + private static final Parameter DEPLOYMENT_TASK_STATUS_PARAM = + new Parameter(DeploymentEngine.DEPLOYMENT_TASK_RUNNING, Boolean.FALSE); /** * Creates a new scheduler task. */ - public SchedulerTask(RepositoryListener listener, ConfigurationContext configCtx) { + public SchedulerTask(RepositoryListener listener, AxisConfiguration axisConfig) { this.wsListener = listener; - this.configCtx = configCtx; + this.axisConfig = axisConfig; } /** @@ -72,13 +77,23 @@ public class SchedulerTask implements Ru * The action to be performed by this scheduler task. */ public void run() { - synchronized (configCtx) { + synchronized (axisConfig) { + Parameter param = + axisConfig.getParameter(DeploymentEngine.DEPLOYMENT_TASK_RUNNING); + if (param == null) { + try { + axisConfig.addParameter(DEPLOYMENT_TASK_STATUS_PARAM); + } catch (AxisFault e) { + // this is thrown only if the parameter is locked. Since we are sure that this + // param will not be locked, we will ignore this + } + } + try { - configCtx.setNonReplicableProperty(DeploymentEngine.DEPLOYMENT_TASK_RUNNING, - Boolean.TRUE); + DEPLOYMENT_TASK_STATUS_PARAM.setValue(Boolean.TRUE); checkRepository(); } finally { - configCtx.removePropertyNonReplicable(DeploymentEngine.DEPLOYMENT_TASK_RUNNING); + DEPLOYMENT_TASK_STATUS_PARAM.setValue(Boolean.FALSE); } } }