ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sath...@apache.org
Subject [21/30] ode git commit: Implement ClusterLock using java generics
Date Fri, 06 Nov 2015 10:51:16 GMT
Implement ClusterLock using java generics


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

Branch: refs/heads/ODE-563
Commit: dfb500c081277bb30b806e6d33468bea1f612533
Parents: cfa4a97
Author: suba <suba.11@cse.mrt.ac.lk>
Authored: Sun Jul 12 19:19:06 2015 +0530
Committer: suba <suba.11@cse.mrt.ac.lk>
Committed: Sun Jul 12 19:19:06 2015 +0530

----------------------------------------------------------------------
 .../ode/axis2/deploy/DeploymentPoller.java      |  8 ++--
 .../ode/axis2/service/DeploymentWebService.java |  8 ++--
 .../org/apache/ode/bpel/clapi/ClusterLock.java  | 30 ++++++++----
 .../apache/ode/bpel/clapi/ClusterManager.java   |  4 +-
 .../bpel/iapi/AbstractInstanceLockManager.java  | 37 ---------------
 .../apache/ode/bpel/engine/BpelEngineImpl.java  | 24 ++--------
 .../ode/bpel/engine/InstanceLockManager.java    | 22 ++++++++-
 .../hazelcast/HazelcastClusterImpl.java         | 14 +++---
 .../hazelcast/HazelcastDeploymentLock.java      | 19 ++++----
 .../hazelcast/HazelcastInstanceLock.java        | 50 +++++++-------------
 .../ode/scheduler/simple/SimpleScheduler.java   | 33 ++++---------
 11 files changed, 97 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 98f5f82..baa790b 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
@@ -369,15 +369,15 @@ public class DeploymentPoller {
         if(clusterEnabled) {
             ClusterLock clusterLock = _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock();
             clusterLock.putIfAbsent(key,key);
-            return clusterLock.tryLockMap(key);
+            return clusterLock.tryLock(key);
         }
         else return true;
     }
 
     private boolean unlock(String key) {
-        if(clusterEnabled) {
-            return _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock().unlockMap(key);
+        if (clusterEnabled) {
+            _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock().unlock(key);
         }
-        else return true;
+        return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
----------------------------------------------------------------------
diff --git a/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java b/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
index 7e4b347..61bf00d 100644
--- a/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
+++ b/axis2/src/main/java/org/apache/ode/axis2/service/DeploymentWebService.java
@@ -389,9 +389,9 @@ public class DeploymentWebService {
         if(clusterEnabled) {
             ClusterLock clusterLock = _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock();
             clusterLock.putIfAbsent(key,key);
-            return clusterLock.lockMap(key);
+            clusterLock.lock(key);
         }
-        else return true;
+        return true;
     }
 
     /**
@@ -399,8 +399,8 @@ public class DeploymentWebService {
      */
     private boolean unlock(String key) {
         if(clusterEnabled) {
-            return _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock().unlockMap(key);
+            _odeServer.getBpelServer().getContexts().clusterManager.getDeploymentLock().unlock(key);
         }
-        else return true;
+        return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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
index 118b275..9c9683f 100644
--- 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
@@ -20,29 +20,38 @@ package org.apache.ode.bpel.clapi;
 
 import java.util.concurrent.TimeUnit;
 
-public interface ClusterLock {
+public interface ClusterLock<E> {
     /**
-     * Acquire the lock for each file in the file system
+     * Acquire the lock for specified key
      *
      * @param key
      * @return
      */
-    boolean lockMap(String key);
+    void lock(E key);
 
     /**
-     * Release the lock acquired by each file
+     * Acquire the lock for specified key and time period
+     *
+     *
+     * @param key
+     * @return
+     */
+    void lock(E key,int time,TimeUnit tu) throws InterruptedException, TimeoutException;
+
+    /**
+     * Release the lock acquired for specified key
      *
      * @param key
      * @return
      */
-    boolean unlockMap(String key);
+    void unlock(E key);
 
     /**
      * Tries to acquire the lock for the specified key
      * @param key
      * @return
      */
-    boolean tryLockMap(String key);
+    boolean tryLock(E key);
 
     /**
      * Tries to acquire the lock for the specified key and time period.
@@ -51,12 +60,17 @@ public interface ClusterLock {
      * @param tu
      * @return
      */
-    boolean tryLockMap(String key, int time, TimeUnit tu);
+    boolean tryLock(E key, int time, TimeUnit tu);
 
     /**
      * Check whether the map has a value for given key, if absent put the value to map
      * @param key
      * @param keyVal
      */
-    void putIfAbsent(String key, String keyVal);
+    void putIfAbsent(E key, E keyVal);
+
+    /** 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/dfb500c0/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 d73810d..70d7c03 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,6 @@
  */
 package org.apache.ode.bpel.clapi;
 
-import org.apache.ode.bpel.iapi.AbstractInstanceLockManager;
-
 import java.io.File;
 
 public interface ClusterManager {
@@ -66,5 +64,5 @@ public interface ClusterManager {
     /**
      * Return instance lock for cluster
      */
-    AbstractInstanceLockManager getInstanceLock();
+    ClusterLock getInstanceLock();
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/bpel-api/src/main/java/org/apache/ode/bpel/iapi/AbstractInstanceLockManager.java
----------------------------------------------------------------------
diff --git a/bpel-api/src/main/java/org/apache/ode/bpel/iapi/AbstractInstanceLockManager.java
b/bpel-api/src/main/java/org/apache/ode/bpel/iapi/AbstractInstanceLockManager.java
deleted file mode 100644
index b53ac65..0000000
--- a/bpel-api/src/main/java/org/apache/ode/bpel/iapi/AbstractInstanceLockManager.java
+++ /dev/null
@@ -1,37 +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.iapi;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Abstract class to implement an instance lock manager
- */
-public abstract class AbstractInstanceLockManager {
-    public abstract void unlock(Long iid);
-
-    public 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;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 fe38cf0..feb4cd1 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
@@ -21,22 +21,12 @@ package org.apache.ode.bpel.engine;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.clapi.ClusterLock;
 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.AbstractInstanceLockManager;
-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;
@@ -60,13 +50,7 @@ import org.w3c.dom.Element;
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -114,7 +98,7 @@ public class BpelEngineImpl implements BpelEngine {
     private SharedEndpoints _sharedEps;
 
     /** Manage instance-level locks. */
-    private final AbstractInstanceLockManager _instanceLockManager;
+    private final ClusterLock<Long> _instanceLockManager;
 
     final Contexts _contexts;
 

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 f712552..1571eac 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,7 +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.iapi.AbstractInstanceLockManager;
+import org.apache.ode.bpel.clapi.ClusterLock;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -37,12 +37,16 @@ import java.util.concurrent.locks.Lock;
  *
  * @author Maciej Szefler - m s z e f l e r @ g m a i l . c o m
  */
-public class InstanceLockManager extends AbstractInstanceLockManager {
+public class InstanceLockManager implements ClusterLock<Long> {
     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>();
 
+    public void lock(Long key) {
+        // Noting to do here.
+    }
+
     public void lock(Long iid, int time, TimeUnit tu) throws InterruptedException, TimeoutException
{
         if (iid == null) return;
 
@@ -106,6 +110,20 @@ public class InstanceLockManager extends AbstractInstanceLockManager
{
 
     }
 
+    public boolean tryLock(Long key) {
+        // Noting to do here.
+        return false;
+    }
+
+    public boolean tryLock(Long key, int time, TimeUnit tu) {
+        // Noting to do here.
+        return false;
+    }
+
+    public void putIfAbsent(Long key, Long keyVal) {
+        // Noting to do here.
+    }
+
 
     @Override
     public String toString() {

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 8eac0b6..5f2b8f5 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,8 +30,6 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import org.apache.ode.bpel.clapi.*;
-import org.apache.ode.bpel.iapi.AbstractInstanceLockManager;
-
 
 /**
  * This class implements necessary methods to build the cluster using hazelcast
@@ -45,11 +43,11 @@ public class HazelcastClusterImpl implements ClusterManager {
     private String uuid;
     private Member leader;
     private IMap<String, String> deployment_lock_map;
-    private IMap<String, String> instance_lock_map;
+    private IMap<Long, Long> instance_lock_map;
     private ITopic<ProcessStoreClusterEvent> clusterMessageTopic;
     private ClusterProcessStore _clusterProcessStore;
-    private ClusterLock _hazelcastDeploymentLock;
-    private AbstractInstanceLockManager _hazelcastInstanceLock;
+    private ClusterLock<String> _hazelcastDeploymentLock;
+    private ClusterLock<Long> _hazelcastInstanceLock;
 
     public void init(File configRoot) {
 
@@ -84,7 +82,7 @@ public class HazelcastClusterImpl implements ClusterManager {
             clusterMessageTopic = _hazelcastInstance.getTopic(HazelcastConstants.ODE_CLUSTER_MSG);
 
             _hazelcastDeploymentLock = (ClusterLock) new HazelcastDeploymentLock(deployment_lock_map);
-            _hazelcastInstanceLock = (AbstractInstanceLockManager) new HazelcastInstanceLock(instance_lock_map);
+            _hazelcastInstanceLock = (ClusterLock) new HazelcastInstanceLock(instance_lock_map);
         }
     }
 
@@ -167,11 +165,11 @@ public class HazelcastClusterImpl implements ClusterManager {
         if(_hazelcastInstance != null) _hazelcastInstance.getLifecycleService().shutdown();
     }
 
-    public ClusterLock getDeploymentLock(){
+    public ClusterLock<String> getDeploymentLock(){
         return _hazelcastDeploymentLock;
     }
 
-    public AbstractInstanceLockManager getInstanceLock(){
+    public ClusterLock<Long> getInstanceLock(){
         return _hazelcastInstanceLock;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 2f5aa4d..f36a1b4 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
@@ -26,7 +26,7 @@ import org.apache.commons.logging.LogFactory;
 
 import java.util.concurrent.TimeUnit;
 
-public class HazelcastDeploymentLock implements ClusterLock{
+public class HazelcastDeploymentLock implements ClusterLock<String>{
     private static final Log __log = LogFactory.getLog(HazelcastDeploymentLock.class);
 
     private IMap<String, String> _lock_map;
@@ -39,23 +39,21 @@ public class HazelcastDeploymentLock implements ClusterLock{
         _lock_map.putIfAbsent(key, keyVal);
     }
 
-    public boolean lockMap(String key) {
+    public void lock(String key) {
         _lock_map.lock(key);
         if (__log.isDebugEnabled()) {
             __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for
" + key + " file" + " after locking: " + true);
         }
-        return true;
     }
 
-    public boolean unlockMap(String key) {
+    public void unlock(String key) {
         _lock_map.unlock(key);
         if (__log.isDebugEnabled()) {
             __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for
" + key + " file" + " after unlocking: " + false);
         }
-        return true;
     }
 
-    public boolean tryLockMap(String key) {
+    public boolean tryLock(String key) {
         boolean state = _lock_map.tryLock(key);
         if (__log.isDebugEnabled()) {
             __log.debug("ThreadID:" + Thread.currentThread().getId() + " duLocked value for
" + key + " file" + " after locking: " + state);
@@ -63,8 +61,13 @@ public class HazelcastDeploymentLock implements ClusterLock{
         return state;
     }
 
-    public boolean tryLockMap(String key,int time, TimeUnit tu) {
+    public boolean tryLock(String key,int time, TimeUnit tu) {
+        // Noting to do here.
+        return false;
+
+    }
+
+    public void lock(String key,int time, TimeUnit tu) {
         // Noting to do here.
-        return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/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 6988746..aa6c086 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,29 +20,31 @@ package org.apache.ode.clustering.hazelcast;
 
 import com.hazelcast.core.IMap;
 import org.apache.ode.bpel.clapi.ClusterLock;
-import org.apache.ode.bpel.iapi.AbstractInstanceLockManager;
 
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class HazelcastInstanceLock extends AbstractInstanceLockManager implements ClusterLock
{
+public class HazelcastInstanceLock implements ClusterLock<Long> {
     private static final Log __log = LogFactory.getLog(HazelcastInstanceLock.class);
 
-    private IMap<String, String> _lock_map;
+    private IMap<Long, Long> _lock_map;
 
 
-    HazelcastInstanceLock(IMap<String, String> lock_map) {
+    HazelcastInstanceLock(IMap<Long, Long> lock_map) {
         _lock_map = lock_map;
     }
 
-    public void putIfAbsent(String key, String keyVal) {
+    public void putIfAbsent(Long key, Long keyVal) {
         _lock_map.putIfAbsent(key, keyVal);
     }
 
-    public void lock(Long iid, int time, TimeUnit tu) throws InterruptedException,
-            AbstractInstanceLockManager.TimeoutException {
+    public void lock(Long key) {
+        // Noting to do here.
+    }
+
+    public void lock(Long iid, int time, TimeUnit tu) throws InterruptedException,TimeoutException
{
         if (iid == null) {
             if (__log.isDebugEnabled()) {
                 __log.debug(" Instance Id null at lock[]");
@@ -56,15 +58,15 @@ public class HazelcastInstanceLock extends AbstractInstanceLockManager
implement
             __log.debug(thrd + ": lock(iid=" + iid + ", time=" + time + tu + ")");
         }
 
-        putIfAbsent(iid.toString(), iid.toString());
+        putIfAbsent(iid, iid);
 
-        if (!tryLockMap(iid.toString(), time, tu)) {
+        if (!_lock_map.tryLock(iid, time, tu)) {
 
             if (__log.isDebugEnabled()) {
                 __log.debug(thrd + ": lock(iid=" + iid + ", " +
                         "time=" + time + tu + ")-->TIMEOUT");
             }
-            throw new AbstractInstanceLockManager.TimeoutException();
+            throw new TimeoutException();
         }
 
     }
@@ -79,40 +81,20 @@ public class HazelcastInstanceLock extends AbstractInstanceLockManager
implement
 
         String thrd = Thread.currentThread().toString();
 
-        unlockMap(iid.toString());
+        _lock_map.unlock(iid);
 
         if (__log.isDebugEnabled()) {
             __log.debug(thrd + " unlock(iid=" + iid + ")");
         }
     }
 
-    public boolean lockMap(String key) {
+    public boolean tryLock(Long key) {
         // Noting to do here.
-        return true;
-    }
-
-    public boolean unlockMap(String key) {
-        if (_lock_map.get(key) == "true") {
-            _lock_map.unlock(key);
-            _lock_map.replace(key, "false");
-            return true;
-        }
         return false;
     }
 
-    public boolean tryLockMap(String key) {
+    public boolean tryLock(Long key, int time, TimeUnit tu) {
         // Noting to do here.
-        return true;
-    }
-
-    public boolean tryLockMap(String key, int time, TimeUnit tu) {
-        boolean state = false;
-        try {
-            state = _lock_map.tryLock(key, time, tu);
-        } catch (InterruptedException ex) {
-            __log.error("Interruption occured" +ex);
-        }
-        _lock_map.replace(key, "" + state);
-        return state;
+        return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/ode/blob/dfb500c0/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
----------------------------------------------------------------------
diff --git a/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
b/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
index a56b86e..a0d67ce 100644
--- a/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
+++ b/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
@@ -19,33 +19,18 @@
 
 package org.apache.ode.scheduler.simple;
 
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArraySet;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.transaction.Status;
-import javax.transaction.Synchronization;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.Scheduler;
 
+import javax.transaction.*;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicLong;
+
 /**
  * A reliable and relatively simple scheduler that uses a database to persist information
about
  * scheduled tasks.
@@ -508,9 +493,9 @@ public class SimpleScheduler implements Scheduler, TaskRunner {
             return;
 
         _todo.stop();
-        _todo.clearTasks(UpgradeJobsTask.class);
+        _todo.clearTasks(UpgradeJobsTask.class);  //check   gsoc
         _todo.clearTasks(LoadImmediateTask.class);
-        _todo.clearTasks(CheckStaleNodes.class);
+        _todo.clearTasks(CheckStaleNodes.class);  //check   gsoc
         _processedSinceLastLoadTask.clear();
         _outstandingJobs.clear();
 


Mime
View raw message