ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sath...@apache.org
Subject [12/30] ode git commit: added patch and log messages
Date Fri, 06 Nov 2015 10:55:22 GMT
added patch and log messages


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

Branch: refs/heads/master
Commit: 7eac2b120049195526698c761a6fae4c12201496
Parents: 4137714
Author: suba <suba.11@cse.mrt.ac.lk>
Authored: Thu Jun 25 23:20:50 2015 +0530
Committer: suba <suba.11@cse.mrt.ac.lk>
Committed: Thu Jun 25 23:20:50 2015 +0530

----------------------------------------------------------------------
 .../java/org/apache/ode/axis2/ODEServer.java    |  1 +
 .../org/apache/ode/bpel/clapi/ClusterLock.java  | 27 ++++++++++++++++++++
 .../apache/ode/bpel/clapi/ClusterManager.java   |  7 +++--
 .../ode/bpel/clapi/ClusterProcessStore.java     | 13 ++++++++++
 .../ode/store/ClusterProcessStoreImpl.java      | 11 ++++++--
 .../hazelcast/HazelcastClusterImpl.java         | 27 ++++++++++----------
 6 files changed, 69 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
----------------------------------------------------------------------
diff --git a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
index 51f05dd..9b133fc 100644
--- a/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
+++ b/axis2/src/main/java/org/apache/ode/axis2/ODEServer.java
@@ -213,6 +213,7 @@ public class ODEServer {
         registerExternalVariableModules();
 
         _store.loadAll();
+        _clusterManager.registerClusterProcessStoreMessageListener();
 
         try {
             _bpelServer.start();

http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterLock.java
----------------------------------------------------------------------
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterLock.java b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterLock.java
new file mode 100644
index 0000000..ff17188
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterLock.java
@@ -0,0 +1,27 @@
+package org.apache.ode.bpel.clapi;
+
+public interface ClusterLock {
+    /**
+     * Acquire the lock for each file in the file system
+     *
+     * @param key
+     * @return
+     */
+    boolean lock(String key);
+
+    /**
+     * Release the lock acquired by each file
+     *
+     * @param key
+     * @return
+     */
+    boolean unlock(String key);
+
+    /**
+     * Tries to acquire the lock for the specified key.
+     *
+     * @param key
+     * @return
+     */
+    boolean tryLock(String key);
+}

http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterManager.java
----------------------------------------------------------------------
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterManager.java b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterManager.java
index da2d668..c57358c 100644
--- a/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterManager.java
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterManager.java
@@ -60,7 +60,7 @@ public interface ClusterManager {
      * Set the Process Store object which uses for clustering
      * @param ps
      */
-    void setClusterProcessStore(Object ps);
+    void setClusterProcessStore(ClusterProcessStore ps);
 
     /**
      * Publish Deploy event to the cluster by deploy initiator
@@ -75,5 +75,8 @@ public interface ClusterManager {
      */
     void putIfAbsent(String key, String keyVal);
 
-
+    /**
+     * Register the cluster for message listener
+     */
+    void registerClusterProcessStoreMessageListener();
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterProcessStore.java
----------------------------------------------------------------------
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterProcessStore.java b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterProcessStore.java
new file mode 100644
index 0000000..45ff33c
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/clapi/ClusterProcessStore.java
@@ -0,0 +1,13 @@
+package org.apache.ode.bpel.clapi;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.iapi.ProcessStore;
+
+public interface ClusterProcessStore extends ProcessStore {
+    public void deployProcesses(String duName);
+
+    public Collection<QName> undeployProcesses(String duName);
+}

http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/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 f0ae9d1..f36ea69 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
@@ -21,6 +21,7 @@ package org.apache.ode.store;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 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.ProcessState;
@@ -29,12 +30,13 @@ import org.apache.ode.il.config.OdeConfigProperties;
 
 import javax.sql.DataSource;
 import javax.xml.namespace.QName;
+
 import java.io.File;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public class ClusterProcessStoreImpl extends ProcessStoreImpl{
+public class ClusterProcessStoreImpl extends ProcessStoreImpl implements ClusterProcessStore
{
     private static final Log __log = LogFactory.getLog(ClusterProcessStoreImpl.class);
 
     private ClusterManager _clusterManager;
@@ -56,9 +58,10 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl{
     private void publishProcessStoreDeployedEvent(String duName){
         deployedEvent = new ProcessStoreDeployedEvent(duName);
         _clusterManager.publishProcessStoreClusterEvent(deployedEvent);
+        __log.info("Completed actual deployment for " +duName +" by " +deployedEvent.getUuid());
     }
 
-    public void publishService(final String duName) {
+    public void deployProcesses(final String duName) {
         final ArrayList<ProcessConfImpl> confs = new ArrayList<ProcessConfImpl>();
         ProcessState state = ProcessState.ACTIVE;
 
@@ -69,6 +72,7 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl{
             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);
             }
         }
@@ -79,6 +83,7 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl{
                     DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName);
                     if (dudao != null) {
                         List<ProcessConfImpl> load = load(dudao);
+                        __log.info("Loading DU from store: " + duName);
                         for(ProcessConfImpl p : load) {
                         _processes.put(p.getProcessId(),p);
                         }
@@ -93,6 +98,7 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl{
 
         for (ProcessConfImpl p : confs) {
             try {
+                __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);
@@ -112,6 +118,7 @@ public class ClusterProcessStoreImpl extends ProcessStoreImpl{
     private void publishProcessStoreUndeployedEvent(String duName){
         undeployedEvent = new ProcessStoreUndeployedEvent(duName);
         _clusterManager.publishProcessStoreClusterEvent(undeployedEvent);
+        __log.info("Completed actual undeployment for " +duName +" by " +undeployedEvent.getUuid());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ode/blob/7eac2b12/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 36859eb..89469e3 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
@@ -30,7 +30,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.ode.bpel.clapi.*;
-import org.apache.ode.store.ClusterProcessStoreImpl;
+
 
 /**
  * This class implements necessary methods to build the cluster using hazelcast
@@ -43,7 +43,7 @@ public class HazelcastClusterImpl implements ClusterManager {
     private Member leader;
     private IMap<String, String> lock_map;
     private ITopic<ProcessStoreClusterEvent> clusterMessageTopic;
-    private ClusterProcessStoreImpl _clusterProcessStore;
+    private ClusterProcessStore _clusterProcessStore;
 
     public void init(File configRoot) {
 
@@ -71,10 +71,7 @@ public class HazelcastClusterImpl implements ClusterManager {
             __log.info("Registering HZ localMember ID " + localMember);
             markAsMaster();
             lock_map = _hazelcastInstance.getMap(HazelcastConstants.ODE_CLUSTER_LOCK_MAP);
-
-            // Register for listening to message listener
             clusterMessageTopic = _hazelcastInstance.getTopic("deployedMsg");
-            clusterMessageTopic.addMessageListener(new ClusterMessageListener());
         }
     }
 
@@ -103,11 +100,12 @@ public class HazelcastClusterImpl implements ClusterManager {
     class ClusterMemberShipListener implements MembershipListener {
         @Override
         public void memberAdded(MembershipEvent membershipEvent) {
-            // Noting to do here.
+            __log.info("Member Added " +membershipEvent.getMember().getUuid());
         }
 
         @Override
         public void memberRemoved(MembershipEvent membershipEvent) {
+            __log.info("Member Removed " +membershipEvent.getMember().getUuid());
             markAsMaster();
         }
 
@@ -119,7 +117,7 @@ public class HazelcastClusterImpl implements ClusterManager {
 
     public void publishProcessStoreClusterEvent(ProcessStoreClusterEvent clusterEvent) {
         clusterEvent.setUuid(_hazelcastInstance.getCluster().getLocalMember().getUuid());
-        __log.info("UUID " +clusterEvent.getUuid());
+        __log.info("Send " +clusterEvent.getInfo() +"Cluster Message " +"for " +clusterEvent.getDuName());
         clusterMessageTopic.publish(clusterEvent);
     }
 
@@ -137,8 +135,8 @@ public class HazelcastClusterImpl implements ClusterManager {
 
             if (!_hazelcastInstance.getCluster().getLocalMember().getUuid().equals(event.getUuid()))
{
                 String duName = event.getDuName();
-                __log.info("Receive deployment msg to " + _hazelcastInstance.getCluster().getLocalMember()
+ " for " + duName);
-                _clusterProcessStore.publishService(duName);
+                __log.info("Receive " +event.getInfo() +"Cluster Message " +"for " +event.getDuName());
+                _clusterProcessStore.deployProcesses(duName);
             }
         }
 
@@ -147,7 +145,7 @@ public class HazelcastClusterImpl implements ClusterManager {
 
             if (!_hazelcastInstance.getCluster().getLocalMember().getUuid().equals(event.getUuid()))
{
                 String duName = event.getDuName();
-                __log.info("Receive undeployment msg to " + _hazelcastInstance.getCluster().getLocalMember()
+ " for " + duName);
+                __log.info("Receive " +event.getInfo() +"Cluster Message " +"for " +event.getDuName());
                 _clusterProcessStore.undeployProcesses(duName);
             }
         }
@@ -166,9 +164,12 @@ public class HazelcastClusterImpl implements ClusterManager {
         return isMaster;
     }
 
-    public void setClusterProcessStore(Object store) {
-        if (store instanceof ClusterProcessStoreImpl)
-            _clusterProcessStore = (ClusterProcessStoreImpl) store;
+    public void setClusterProcessStore(ClusterProcessStore store) {
+            _clusterProcessStore = store;
+    }
+
+    public void registerClusterProcessStoreMessageListener() {
+        clusterMessageTopic.addMessageListener(new ClusterMessageListener());
     }
 }
 


Mime
View raw message