ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sath...@apache.org
Subject [14/30] ode git commit: completed improvements-1
Date Fri, 06 Nov 2015 10:51:09 GMT
completed improvements-1


Project: http://git-wip-us.apache.org/repos/asf/ode/repo
Commit: http://git-wip-us.apache.org/repos/asf/ode/commit/82143f47
Tree: http://git-wip-us.apache.org/repos/asf/ode/tree/82143f47
Diff: http://git-wip-us.apache.org/repos/asf/ode/diff/82143f47

Branch: refs/heads/ODE-563
Commit: 82143f4736a4063eda0a467532ae1188cb00cbbe
Parents: ca74e00
Author: suba <suba.11@cse.mrt.ac.lk>
Authored: Tue Jun 30 00:04:23 2015 +0530
Committer: suba <suba.11@cse.mrt.ac.lk>
Committed: Tue Jun 30 00:04:23 2015 +0530

----------------------------------------------------------------------
 .../ode/axis2/deploy/DeploymentPoller.java      | 39 +++++++++++++++-----
 .../ode/store/ClusterProcessStoreImpl.java      | 32 ++++++++--------
 .../org/apache/ode/store/ProcessStoreImpl.java  |  4 +-
 .../hazelcast/HazelcastClusterImpl.java         | 16 +++++---
 .../hazelcast/HazelcastConstants.java           |  4 +-
 5 files changed, 63 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/82143f47/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
----------------------------------------------------------------------
diff --git a/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java b/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
index ed84f35..7912db6 100644
--- a/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
+++ b/axis2/src/main/java/org/apache/ode/axis2/deploy/DeploymentPoller.java
@@ -140,7 +140,9 @@ public class DeploymentPoller {
         if (isDeploymentFromODEFileSystemAllowed() && files != null) {
             for (File file : files) {
                 String duName = file.getName();
-                __log.info("Trying to acquire the lock for " + duName);
+                if (__log.isDebugEnabled()) {
+                __log.debug("Trying to acquire the lock for " + duName);
+                }
                 duLocked = pollerTryLock(duName);
 
                 if (duLocked) {
@@ -187,7 +189,9 @@ public class DeploymentPoller {
                             __log.error("Deployment of " + file.getName() + " failed, aborting
for now.", e);
                         }
                     } finally {
-                        __log.info("Trying to release the lock for " + file.getName());
+                        if (__log.isDebugEnabled()) {
+                        __log.debug("Trying to release the lock for " + file.getName());
+                        }
                         unlock(file.getName());
                     }
                 }
@@ -200,16 +204,33 @@ public class DeploymentPoller {
             String pkg = file.getName().substring(0, file.getName().length() - ".deployed".length());
             File deployDir = new File(_deployDir, pkg);
             if (!deployDir.exists()) {
-                Collection<QName> undeployed = _odeServer.getProcessStore().undeploy(deployDir);
-                boolean isDeleted = file.delete();
-                if (!isDeleted) {
-                    __log.error("Error while deleting file "
+                String duName = deployDir.getName();
+
+                if (__log.isDebugEnabled()) {
+                    __log.debug("Trying to acquire the lock for " + duName);
+                }
+
+                duLocked = pollerTryLock(duName);
+
+                if (duLocked) {
+                    try {
+                        Collection<QName> undeployed = _odeServer.getProcessStore().undeploy(deployDir);
+                        boolean isDeleted = file.delete();
+                        if (!isDeleted) {
+                            __log.error("Error while deleting file "
                                     + file.getName()
                                     + ".deployed , please check if file is locked or if it
really exist");
+                        }
+                        disposeDeployXmlWatchDog(deployDir);
+                        if (undeployed.size() > 0)
+                            __log.info("Successfully undeployed " + pkg);
+                    } finally {
+                        if (__log.isDebugEnabled()) {
+                            __log.debug("Trying to release the lock for " + duName);
+                        }
+                        unlock(duName);
+                    }
                 }
-                disposeDeployXmlWatchDog(deployDir);
-                if (undeployed.size() > 0)
-                    __log.info("Successfully undeployed " + pkg);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ode/blob/82143f47/bpel-store/src/main/java/org/apache/ode/store/ClusterProcessStoreImpl.java
----------------------------------------------------------------------
diff --git a/bpel-store/src/main/java/org/apache/ode/store/ClusterProcessStoreImpl.java b/bpel-store/src/main/java/org/apache/ode/store/ClusterProcessStoreImpl.java
index f36ea69..51fea5a 100644
--- a/bpel-store/src/main/java/org/apache/ode/store/ClusterProcessStoreImpl.java
+++ b/bpel-store/src/main/java/org/apache/ode/store/ClusterProcessStoreImpl.java
@@ -24,6 +24,7 @@ import org.apache.ode.bpel.clapi.ClusterManager;
 import org.apache.ode.bpel.clapi.ClusterProcessStore;
 import org.apache.ode.bpel.clapi.ProcessStoreDeployedEvent;
 import org.apache.ode.bpel.clapi.ProcessStoreUndeployedEvent;
+import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.ProcessState;
 import org.apache.ode.bpel.iapi.EndpointReferenceContext;
 import org.apache.ode.il.config.OdeConfigProperties;
@@ -67,13 +68,20 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl implements
Cluster
 
         Pattern duNamePattern = getPreviousPackageVersionPattern(duName);
 
-        for (QName key : _processes.keySet()) {
-            ProcessConfImpl pconf = _processes.get(key);
-            Matcher matcher = duNamePattern.matcher(pconf.getPackage());
-            if (matcher.matches() && pconf.getState().equals(state)) {
-                  pconf.setState(ProcessState.RETIRED);
-                __log.info("Set state of " +pconf.getProcessId() +"to " +pconf.getState());
-                  confs.add(pconf);
+        for (String packageName : _deploymentUnits.keySet()) {
+            Matcher matcher = duNamePattern.matcher(packageName);
+            if (matcher.matches()) {
+                DeploymentUnitDir duDir = _deploymentUnits.get(packageName);
+                if (duDir == null) throw new ContextException("Could not find package " +
packageName);
+                for (QName processName : duDir.getProcessNames()) {
+                    QName pid = toPid(processName, duDir.getVersion());
+                    ProcessConfImpl pconf = _processes.get(pid);
+                    if (pconf.getState().equals(state)) {
+                        pconf.setState(ProcessState.RETIRED);
+                        __log.info("Set state of " + pconf.getProcessId() + "to " + pconf.getState());
+                        confs.add(pconf);
+                    }
+                }
             }
         }
 
@@ -84,9 +92,6 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl implements
Cluster
                     if (dudao != null) {
                         List<ProcessConfImpl> load = load(dudao);
                         __log.info("Loading DU from store: " + duName);
-                        for(ProcessConfImpl p : load) {
-                        _processes.put(p.getProcessId(),p);
-                        }
                         confs.addAll(load);
                     }
                     return null;
@@ -98,19 +103,17 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl implements
Cluster
 
         for (ProcessConfImpl p : confs) {
             try {
-                __log.info("Fire event of " + p.getProcessId()  +" " +p.getState());
+                __log.info("Fire event of " + p.getProcessId() + " " + p.getState());
                 fireStateChange(p.getProcessId(), p.getState(), p.getDeploymentUnit().getName());
             } catch (Exception except) {
-                __log.error("Error with process retiring or activating : pid=" + p.getProcessId()
+ " package="+p.getDeploymentUnit().getName(), except);
+                __log.error("Error with process retiring or activating : pid=" + p.getProcessId()
+ " package=" + p.getDeploymentUnit().getName(), except);
             }
         }
     }
 
 
-
     public Collection<QName> undeploy(final File dir) {
         Collection<QName> undeployed = super.undeploy(dir);
-        _processes.keySet().removeAll(undeployed);
         publishProcessStoreUndeployedEvent(dir.getName());
         return undeployed;
     }
@@ -128,7 +131,6 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl implements
Cluster
      */
     public Collection<QName> undeployProcesses(final String duName) {
         Collection<QName> undeployed = super.undeployProcesses(duName);
-        _processes.keySet().removeAll(undeployed);
         return undeployed;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/82143f47/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
----------------------------------------------------------------------
diff --git a/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java b/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
index 0658b66..91f0bff 100644
--- a/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
+++ b/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
@@ -73,7 +73,7 @@ public class ProcessStoreImpl implements ProcessStore {
 
     protected Map<QName, ProcessConfImpl> _processes = new HashMap<QName, ProcessConfImpl>();
 
-    private Map<String, DeploymentUnitDir> _deploymentUnits = new HashMap<String,
DeploymentUnitDir>();
+    protected Map<String, DeploymentUnitDir> _deploymentUnits = new HashMap<String,
DeploymentUnitDir>();
 
     /** Guards access to the _processes and _deploymentUnits */
     private final ReadWriteLock _rw = new ReentrantReadWriteLock();
@@ -849,7 +849,7 @@ public class ProcessStoreImpl implements ProcessStore {
         return result;
     }
 
-    private QName toPid(QName processType, long version) {
+    protected QName toPid(QName processType, long version) {
         return new QName(processType.getNamespaceURI(), processType.getLocalPart() + "-"
+ version);
     }
 

http://git-wip-us.apache.org/repos/asf/ode/blob/82143f47/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java
----------------------------------------------------------------------
diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java
b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java
index 89469e3..c721373 100644
--- a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java
+++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastClusterImpl.java
@@ -70,8 +70,8 @@ public class HazelcastClusterImpl implements ClusterManager {
             Member localMember = _hazelcastInstance.getCluster().getLocalMember();
             __log.info("Registering HZ localMember ID " + localMember);
             markAsMaster();
-            lock_map = _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_LOCK_MAP);
-            clusterMessageTopic = _hazelcastInstance.getTopic("deployedMsg");
+            lock_map = _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_DEPLOYMENT_LOCK);
+            clusterMessageTopic = _hazelcastInstance.getTopic(HazelcastConstants.ODE_CLUSTER_MSG);
         }
     }
 
@@ -81,19 +81,25 @@ public class HazelcastClusterImpl implements ClusterManager {
 
     public boolean lock(String key) {
         lock_map.lock(key);
-        __log.info("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after locking: " + true);
+        if (__log.isDebugEnabled()) {
+        __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after locking: " + true);
+        }
         return true;
     }
 
     public boolean unlock(String key) {
         lock_map.unlock(key);
-        __log.info("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after unlocking: " + false);
+        if (__log.isDebugEnabled()) {
+        __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after unlocking: " + false);
+        }
         return true;
     }
 
     public boolean tryLock(String key) {
         boolean state = lock_map.tryLock(key);
-        __log.info("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after locking: " + state);
+        if (__log.isDebugEnabled()) {
+        __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for "
+ key + " file" + " after locking: " + state);
+        }
         return state;
     }
 

http://git-wip-us.apache.org/repos/asf/ode/blob/82143f47/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java
----------------------------------------------------------------------
diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java
b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java
index f9d1004..76e7341 100644
--- a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java
+++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastConstants.java
@@ -21,7 +21,9 @@ package org.apache.ode.clustering.hazelcast;
  * Constants used in Hazelcast based clustering implementation
  */
 public final class HazelcastConstants {
-    public static final String ODE_CLUSTER_LOCK_MAP = "ODE_LOCK_MAP";
+    public static final String ODE_CLUSTER_DEPLOYMENT_LOCK = "DEPLOYMENT_LOCK";
+    public static final String ODE_CLUSTER_PROCESS_INSTANCE_LOCK  = "PROCESS_INSTANCE_LOCK
";
+    public static final String ODE_CLUSTER_MSG = "CLUSTER_MSG";
 
     private HazelcastConstants() {
     }


Mime
View raw message