ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sath...@apache.org
Subject [18/30] ode git commit: fixed errors with instance lock manager
Date Fri, 06 Nov 2015 10:51:13 GMT
fixed errors with instance lock manager


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

Branch: refs/heads/ODE-563
Commit: f1f9f3f1ebd87c988fa390c532dd5d7818760fdc
Parents: 4a101a4
Author: suba <suba.11@cse.mrt.ac.lk>
Authored: Thu Jul 9 10:02:09 2015 +0530
Committer: suba <suba.11@cse.mrt.ac.lk>
Committed: Thu Jul 9 10:02:09 2015 +0530

----------------------------------------------------------------------
 .../ode/bpel/AbstractInstanceLockManager.java   | 38 +++++++++++++++++++
 .../apache/ode/bpel/clapi/ClusterManager.java   |  6 ++-
 .../engine/AbstractInstanceLockManager.java     | 38 -------------------
 .../apache/ode/bpel/engine/BpelEngineImpl.java  | 39 ++++++--------------
 .../ode/bpel/engine/InstanceLockManager.java    | 10 ++---
 .../hazelcast/HazelcastClusterImpl.java         |  1 +
 .../hazelcast/HazelcastDeploymentLock.java      |  3 ++
 .../hazelcast/HazelcastInstanceLock.java        |  6 ++-
 8 files changed, 65 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/bpel-api/src/main/java/org/apache/ode/bpel/AbstractInstanceLockManager.java
----------------------------------------------------------------------
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/AbstractInstanceLockManager.java b/bpel-api/src/main/java/org/apache/ode/bpel/AbstractInstanceLockManager.java
new file mode 100644
index 0000000..7a34b2c
--- /dev/null
+++ b/bpel-api/src/main/java/org/apache/ode/bpel/AbstractInstanceLockManager.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ode.bpel;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Abstract class to implement an instance lock manager. Instance lock provide process instance
isolation from
+ * concurrent access when entering jacob
+ */
+public abstract class AbstractInstanceLockManager {
+    abstract public void unlock(Long iid);
+
+    abstract public void lock(Long iid, int i, TimeUnit microseconds) throws InterruptedException,
+            TimeoutException;
+
+    /** Exception class indicating a time-out occured  while obtaining a lock. */
+    public static final class TimeoutException extends Exception {
+        private static final long serialVersionUID = 7247629086692580285L;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/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 25110b4..4616126 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
@@ -18,8 +18,9 @@
  */
 package org.apache.ode.bpel.clapi;
 
+import org.apache.ode.bpel.AbstractInstanceLockManager;
+
 import java.io.File;
-import org.apache.ode.bpel.engine.AbstractInstnaceLockManager;
 
 public interface ClusterManager {
 
@@ -58,5 +59,6 @@ public interface ClusterManager {
     void registerClusterProcessStoreMessageListener();
 
     ClusterLock getDeploymentLock();
-    org.apache.ode.bpel.engine.AbstractInstanceLockManager getInstanceLock();
+
+    AbstractInstanceLockManager getInstanceLock();
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/AbstractInstanceLockManager.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/AbstractInstanceLockManager.java
b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/AbstractInstanceLockManager.java
deleted file mode 100644
index a534e11..0000000
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/AbstractInstanceLockManager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.ode.bpel.engine;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Abstract class to implement an instance lock manager. Instance lock provide process instance
isolation from
- * concurrent access when entering jacob
- */
-public abstract class AbstractInstanceLockManager {
-    abstract void unlock(Long iid);
-
-    abstract void lock(Long iid, int i, TimeUnit microseconds) throws InterruptedException,
-            TimeoutException;
-
-    /** Exception class indicating a time-out occured  while obtaining a lock. */
-    public static final class TimeoutException extends Exception {
-        private static final long serialVersionUID = 7247629086692580285L;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
index 5bef134..e278c7d 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
@@ -19,42 +19,19 @@
 
 package org.apache.ode.bpel.engine;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
-
-import javax.wsdl.Operation;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.AbstractInstanceLockManager;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.dao.ProcessInstanceDAO;
 import org.apache.ode.bpel.evt.BpelEvent;
-import org.apache.ode.bpel.iapi.BpelEngine;
-import org.apache.ode.bpel.iapi.BpelEngineException;
-import org.apache.ode.bpel.iapi.ContextException;
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MessageExchange;
-import org.apache.ode.bpel.iapi.OdeGlobalConfig;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
-import org.apache.ode.bpel.iapi.ProcessState;
-import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.*;
 import org.apache.ode.bpel.iapi.MessageExchange.FailureType;
 import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
 import org.apache.ode.bpel.iapi.MessageExchange.Status;
 import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
 import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
-import org.apache.ode.bpel.iapi.Scheduler.JobInfo;
 import org.apache.ode.bpel.iapi.Scheduler.JobType;
 import org.apache.ode.bpel.intercept.InterceptorInvoker;
 import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
@@ -70,6 +47,12 @@ import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Implementation of the {@link BpelEngine} interface: provides the server methods that should
be invoked in the context of a
  * transaction.
@@ -115,7 +98,7 @@ public class BpelEngineImpl implements BpelEngine {
     private SharedEndpoints _sharedEps;
 
     /** Manage instance-level locks. */
-    private  AbstractInstanceLockManager _instanceLockManager;
+    private AbstractInstanceLockManager _instanceLockManager;
 
     final Contexts _contexts;
 
@@ -127,7 +110,6 @@ public class BpelEngineImpl implements BpelEngine {
         if(_contexts.clusterManager != null) {
             _instanceLockManager = _contexts.clusterManager.getInstanceLock();
         }
-
         else _instanceLockManager = new InstanceLockManager();
         _sharedEps = new SharedEndpoints();
         _sharedEps.init();
@@ -435,7 +417,8 @@ public class BpelEngineImpl implements BpelEngine {
         // Note that we don't want to wait too long here to get our lock, since we are likely
holding
         // on to scheduler's locks of various sorts.
         try {
-            _instanceLockManager.lock(iid, 1, TimeUnit.MICROSECONDS);
+            _instanceLockManager.
+                    lock(iid, 1, TimeUnit.MICROSECONDS);
             _contexts.scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
                 public void afterCompletion(boolean success) {
                     _instanceLockManager.unlock(iid);

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/InstanceLockManager.java
----------------------------------------------------------------------
diff --git a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/InstanceLockManager.java
b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/InstanceLockManager.java
index 652d2ec..dba127b 100644
--- a/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/InstanceLockManager.java
+++ b/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/InstanceLockManager.java
@@ -20,6 +20,7 @@ package org.apache.ode.bpel.engine;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.AbstractInstanceLockManager;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -40,7 +41,7 @@ public class InstanceLockManager extends AbstractInstanceLockManager {
     private static final Log __log = LogFactory.getLog(InstanceLockManager.class);
 
     private final Lock _mutex = new java.util.concurrent.locks.ReentrantLock();
-    private final Map<Long, InstanceInfo> _locks = new HashMap<Long,InstanceInfo>
();
+    private final Map<Long, InstanceInfo> _locks = new HashMap<Long,InstanceInfo>();
 
     public void lock(Long iid, int time, TimeUnit tu) throws InterruptedException, TimeoutException
{
         if (iid == null) return;
@@ -135,9 +136,6 @@ public class InstanceLockManager extends AbstractInstanceLockManager {
             return "{Lock for Instance #" + iid +", acquired by " +  acquierer + "}";
         }
     }
-
-    /** Exception class indicating a time-out occured while obtaining a lock. */
-    /*public static final class TimeoutException extends Exception {
-        private static final long serialVersionUID = 7247629086692580285L;
-    }*/
 }
+
+

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/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 fb25606..8bd9c7d 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,6 +30,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.ode.bpel.clapi.*;
+import org.apache.ode.bpel.AbstractInstanceLockManager;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastDeploymentLock.java
----------------------------------------------------------------------
diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastDeploymentLock.java
b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastDeploymentLock.java
index 4d0aac1..34fa5d4 100644
--- a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastDeploymentLock.java
+++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastDeploymentLock.java
@@ -21,6 +21,9 @@ package org.apache.ode.clustering.hazelcast;
 import com.hazelcast.core.IMap;
 import org.apache.ode.bpel.clapi.ClusterLock;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 public class HazelcastDeploymentLock implements ClusterLock{
     private static final Log __log = LogFactory.getLog(HazelcastDeploymentLock.class);
 

http://git-wip-us.apache.org/repos/asf/ode/blob/f1f9f3f1/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceLock.java
----------------------------------------------------------------------
diff --git a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceLock.java
b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceLock.java
index 3b8ab41..e673a81 100644
--- a/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceLock.java
+++ b/clustering/src/main/java/org/apache/ode/clustering/hazelcast/HazelcastInstanceLock.java
@@ -20,11 +20,13 @@ package org.apache.ode.clustering.hazelcast;
 
 import com.hazelcast.core.IMap;
 import org.apache.ode.bpel.clapi.ClusterLock;
-import org.apache.ode.bpel.engine.AbstractInstnaceLockManager;
+import org.apache.ode.bpel.AbstractInstanceLockManager;
 
 import java.util.concurrent.TimeUnit;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
-public class HazelcastInstanceLock extends AbstractInstnaceLockManager implements ClusterLock
{
+public class HazelcastInstanceLock extends AbstractInstanceLockManager implements ClusterLock
{
     private static final Log __log = LogFactory.getLog(HazelcastInstanceLock.class);
 
     private IMap<String, String> _lock_map;


Mime
View raw message