You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by az...@apache.org on 2010/10/05 17:52:39 UTC
svn commit: r1004684 - in
/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment:
DeploymentEngine.java scheduler/SchedulerTask.java
Author: azeez
Date: Tue Oct 5 15:52:38 2010
New Revision: 1004684
URL: http://svn.apache.org/viewvc?rev=1004684&view=rev
Log:
Added a method to check whether the deployment task is running. If an Axis2 server is shutdown while the deployment task is running, there can be exceptions that are thrown. So. in a graceful shutdown scenario, we can first check whether the deployment task is running, and then initiate the shutdown procedure, once the task has ended.
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=1004684&r1=1004683&r2=1004684&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 Oct 5 15:52:38 2010
@@ -75,6 +75,11 @@ import java.util.zip.ZipInputStream;
public abstract class DeploymentEngine implements DeploymentConstants {
private static final Log log = LogFactory.getLog(DeploymentEngine.class);
+ /**
+ * Indicates that the deployment task is running
+ */
+ public static final String DEPLOYMENT_TASK_RUNNING = "deployment.task.running";
+
//to keep the web resource location if any
protected static String webLocationString = null;
protected Scheduler scheduler;
@@ -870,7 +875,19 @@ public abstract class DeploymentEngine i
protected void startSearch(RepositoryListener listener) {
scheduler = new Scheduler();
- scheduler.schedule(new SchedulerTask(listener), new DeploymentIterator());
+ scheduler.schedule(new SchedulerTask(listener, configContext), new DeploymentIterator());
+ }
+
+ /**
+ * Method to check whether the deployment task is currently running. Will be used is graceful
+ * shutdown & restart scenarios.
+ *
+ * @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;
}
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=1004684&r1=1004683&r2=1004684&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 Oct 5 15:52:38 2010
@@ -20,6 +20,8 @@
package org.apache.axis2.deployment.scheduler;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.DeploymentEngine;
import org.apache.axis2.deployment.RepositoryListener;
import java.util.TimerTask;
@@ -31,12 +33,14 @@ public class SchedulerTask implements Ru
int state = 0;
TimerTask timerTask;
private RepositoryListener wsListener;
+ private ConfigurationContext configCtx;
/**
* Creates a new scheduler task.
*/
- public SchedulerTask(RepositoryListener listener) {
+ public SchedulerTask(RepositoryListener listener, ConfigurationContext configCtx) {
this.wsListener = listener;
+ this.configCtx = configCtx;
}
/**
@@ -68,6 +72,13 @@ public class SchedulerTask implements Ru
* The action to be performed by this scheduler task.
*/
public void run() {
- checkRepository();
+ synchronized (configCtx) {
+ try {
+ configCtx.setNonReplicableProperty(DeploymentEngine.DEPLOYMENT_TASK_RUNNING, "true");
+ checkRepository();
+ } finally {
+ configCtx.removePropertyNonReplicable(DeploymentEngine.DEPLOYMENT_TASK_RUNNING);
+ }
+ }
}
}