diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/pom.xml b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/pom.xml
index d340bc1..b03ce97 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/pom.xml
@@ -1,5 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs
+  =============================================================================
+  Licensed 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.
+
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>lock-manager-lib</artifactId>
@@ -8,6 +33,7 @@
     </parent>
 
     <artifactId>lock-manager-api</artifactId>
+    <name>APPC Lock Manager - API</name>
     <packaging>bundle</packaging>
 
     <build>
@@ -24,4 +50,4 @@
             </plugin>
         </plugins>
     </build>
-</project>
\ No newline at end of file
+</project>
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/src/main/java/org/onap/appc/lockmanager/api/LockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/src/main/java/org/onap/appc/lockmanager/api/LockManager.java
index e6a0fb7..7236906 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/src/main/java/org/onap/appc/lockmanager/api/LockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-api/src/main/java/org/onap/appc/lockmanager/api/LockManager.java
@@ -69,4 +69,13 @@
 
     boolean isLocked(String resource);
 
+    /**
+     * returns the oner of the resource
+     * if no one owns, returns null
+     * @param resource
+     * @return owner of the resource
+     */
+
+    String getLockOwner(String resource);
+
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-features/pom.xml b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-features/pom.xml
index 4f34bba..af35565 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-features/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-features/pom.xml
@@ -1,107 +1,133 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <artifactId>lock-manager-lib</artifactId>
-    <groupId>org.onap.appc</groupId>
-    <version>1.3.0-SNAPSHOT</version>
-  </parent>
-  <name>lock-manager-features</name>
-  <artifactId>lock-manager-features</artifactId>
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs
+  =============================================================================
+  Licensed 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
 
-  <packaging>jar</packaging>
+       http://www.apache.org/licenses/LICENSE-2.0
 
-  <dependencies>
-     <dependency>
-      <groupId>org.onap.appc</groupId>
-      <artifactId>lock-manager-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>  	
-     <dependency>
-      <groupId>org.onap.appc</groupId>
-      <artifactId>lock-manager-impl</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-  </dependencies>
+  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.
 
-  <build>
-    <resources>
-      <resource>
-        <filtering>true</filtering>
-        <directory>src/main/resources</directory>
-      </resource>
-    </resources>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-resources-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>filter</id>
-            <goals>
-              <goal>resources</goal>
-            </goals>
-            <phase>generate-resources</phase>
-          </execution>
-        </executions>
-      </plugin>
-      <!--<plugin>
-        &lt;!&ndash; launches the feature test, which validates that your karaf feature
-          can be installed inside of a karaf container. It doesn't validate that your 
-          functionality works correctly, just that you have all of the dependent bundles 
-          defined correctly. &ndash;&gt;
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.16</version>
-        <configuration>
-          <systemPropertyVariables>
-            <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
-            <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
-            <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
-          </systemPropertyVariables>
-          <dependenciesToScan>
-            <dependency>org.opendaylight.yangtools:features-test</dependency>
-          </dependenciesToScan>
-          <classpathDependencyExcludes>
-            &lt;!&ndash; The dependencies which bring in AbstractDataBrokerTest class
-              brings in a second PaxExam container which results in the feature tests failing 
-              with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous 
-              TestContainer ..." This excludes the container we don't want to use. &ndash;&gt;
-            <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
-          </classpathDependencyExcludes>
-        </configuration>
-      </plugin>-->
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-artifacts</id>
-            <goals>
-              <goal>attach-artifact</goal>
-            </goals>
-            <phase>package</phase>
-            <configuration>
-              <artifacts>
-                <artifact>
-                  <file>${project.build.directory}/classes/${features.file}</file>
-                  <type>xml</type>
-                  <classifier>features</classifier>
-                </artifact>
-              </artifacts>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      
-      <!-- Skipping ODL feature test -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <skipTests>true</skipTests>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>lock-manager-lib</artifactId>
+        <groupId>org.onap.appc</groupId>
+        <version>1.3.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>lock-manager-features</artifactId>
+    <name>APPC Lock Manager - feature</name>
+    <packaging>jar</packaging>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.appc</groupId>
+            <artifactId>lock-manager-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.appc</groupId>
+            <artifactId>lock-manager-impl</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <filtering>true</filtering>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>filter</id>
+                        <goals>
+                            <goal>resources</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <!--<plugin>
+              &lt;!&ndash; launches the feature test, which validates that your karaf feature
+                can be installed inside of a karaf container. It doesn't validate that your
+                functionality works correctly, just that you have all of the dependent bundles
+                defined correctly. &ndash;&gt;
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-surefire-plugin</artifactId>
+              <version>2.16</version>
+              <configuration>
+                <systemPropertyVariables>
+                  <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+                  <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+                  <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+                </systemPropertyVariables>
+                <dependenciesToScan>
+                  <dependency>org.opendaylight.yangtools:features-test</dependency>
+                </dependenciesToScan>
+                <classpathDependencyExcludes>
+                  &lt;!&ndash; The dependencies which bring in AbstractDataBrokerTest class
+                    brings in a second PaxExam container which results in the feature tests failing
+                    with a message similar to: "ERROR o.ops4j.pax.exam.spi.PaxExamRuntime - Ambiguous
+                    TestContainer ..." This excludes the container we don't want to use. &ndash;&gt;
+                  <classpathDependencyExcludes>org.ops4j.pax.exam:pax-exam-container-native</classpathDependencyExcludes>
+                </classpathDependencyExcludes>
+              </configuration>
+            </plugin>-->
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-artifacts</id>
+                        <goals>
+                            <goal>attach-artifact</goal>
+                        </goals>
+                        <phase>package</phase>
+                        <configuration>
+                            <artifacts>
+                                <artifact>
+                                    <file>${project.build.directory}/classes/${features.file}</file>
+                                    <type>xml</type>
+                                    <classifier>features</classifier>
+                                </artifact>
+                            </artifacts>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Skipping ODL feature test -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/pom.xml b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/pom.xml
index a4334a2..40a7f50 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/pom.xml
@@ -1,5 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs
+  =============================================================================
+  Licensed 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.
+
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>lock-manager-lib</artifactId>
@@ -8,8 +33,10 @@
     </parent>
 
     <artifactId>lock-manager-impl</artifactId>
+    <name>APPC Lock Manager - Impl</name>
     <packaging>bundle</packaging>
 
+
     <dependencies>
         <dependency>
             <groupId>org.onap.appc</groupId>
@@ -45,8 +72,7 @@
                     <instructions>
                         <Export-Service>org.onap.appc.lockmanager.api.LockManager</Export-Service>
                         <Import-Package>
-                            org.onap.appc.lockmanager.api.*,
-                            org.onap.appc.dao.util,com.att.eelf.configuration, *;resolution:=optional
+                            org.onap.appc.lockmanager.api.*, com.att.eelf.configuration, *;resolution:=optional
                         </Import-Package>
                         <Private-Package>org.onap.appc.lockmanager.impl.*</Private-Package>
                         <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/inmemory/LockManagerInMemoryImpl.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/inmemory/LockManagerInMemoryImpl.java
index b141d96..140d9eb 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/inmemory/LockManagerInMemoryImpl.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/inmemory/LockManagerInMemoryImpl.java
@@ -38,7 +38,7 @@
     private static LockManagerInMemoryImpl instance = null;
     private Map<String, LockValue> lockedVNFs;
 
-    private static final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
+    private final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger();
 
     private LockManagerInMemoryImpl() {
         lockedVNFs = new ConcurrentHashMap<>();
@@ -110,7 +110,12 @@
 
     @Override
     public boolean isLocked(String resource) {
-        return lockedVNFs.get(resource)!=null?true:false;
+        return lockedVNFs.get(resource) != null;
+    }
+
+    @Override
+    public String getLockOwner(String resource) {
+        return lockedVNFs.get(resource).getOwner();
     }
 
     private boolean lockIsMine(LockValue lockValue, String owner, long now) {
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/JdbcLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/JdbcLockManager.java
index 9b20831..b8cf0f7 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/JdbcLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/JdbcLockManager.java
@@ -26,7 +26,8 @@
 
 import java.sql.Connection;
 
-import org.onap.appc.dao.util.JdbcConnectionFactory;
+
+import org.onap.appc.dao.util.api.JdbcConnectionFactory;
 import org.onap.appc.lockmanager.api.LockManager;
 
 public abstract class JdbcLockManager implements LockManager {
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/Messages.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/Messages.java
index 769d942..4f28311 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/Messages.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/Messages.java
@@ -27,7 +27,7 @@
 public enum Messages {
 
     ERR_NULL_LOCK_OWNER("Cannot acquire lock for resource [%s]: lock owner must be specified"),
-    ERR_LOCK_LOCKED_BY_OTHER("Cannot lock resource [%s] for [%s]: already locked by [%s]"),
+    ERR_LOCK_LOCKED_BY_OTHER("VNF : [%s] is locked by request id : [%s]"),
     ERR_UNLOCK_NOT_LOCKED("Error unlocking resource [%s]: resource is not locked"),
     ERR_UNLOCK_LOCKED_BY_OTHER("Error unlocking resource [%s] by [%s]: resource is locked by [%s]"),
     EXP_LOCK("Error locking resource [%s]."),
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/MySqlConnectionFactory.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/MySqlConnectionFactory.java
index 4df8954..7f91d21 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/MySqlConnectionFactory.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/MySqlConnectionFactory.java
@@ -32,6 +32,8 @@
 public class MySqlConnectionFactory extends DefaultJdbcConnectionFactory {
 
     protected void registedDriver() throws SQLException {
-        DriverManager.registerDriver(new org.mariadb.jdbc.Driver());
+    DriverManager.registerDriver(new org.mariadb.jdbc.Driver());
+    
     }
+
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/LockRecord.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/LockRecord.java
index ff0e63b..94e656d 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/LockRecord.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/LockRecord.java
@@ -26,49 +26,49 @@
 
 class LockRecord {
 
-	private String resource;
-	private String owner;
-	private long updated;
-	private long timeout;
-	private long ver;
+    private String resource;
+    private String owner;
+    private long updated;
+    private long timeout;
+    private long ver;
 
-	LockRecord(String resource) {
-		this.resource = resource;
-	}
+    LockRecord(String resource) {
+        this.resource = resource;
+    }
 
-	public String getResource() {
-		return resource;
-	}
+    public String getResource() {
+        return resource;
+    }
 
-	public String getOwner() {
-		return owner;
-	}
+    public String getOwner() {
+        return owner;
+    }
 
-	public void setOwner(String owner) {
-		this.owner = owner;
-	}
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
 
-	public long getUpdated() {
-		return updated;
-	}
+    public long getUpdated() {
+        return updated;
+    }
 
-	public void setUpdated(long updated) {
-		this.updated = updated;
-	}
+    public void setUpdated(long updated) {
+        this.updated = updated;
+    }
 
-	public long getTimeout() {
-		return timeout;
-	}
+    public long getTimeout() {
+        return timeout;
+    }
 
-	public void setTimeout(long timeout) {
-		this.timeout = timeout;
-	}
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
 
-	public long getVer() {
-		return ver;
-	}
+    public long getVer() {
+        return ver;
+    }
 
-	public void setVer(long ver) {
-		this.ver = ver;
-	}
+    public void setVer(long ver) {
+        this.ver = ver;
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManager.java
index d1dd2c5..1cbc1fb 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManager.java
@@ -28,8 +28,10 @@
 
 public class MySqlLockManager extends SqlLockManager {
 
-	@Override
-	protected boolean isDuplicatePkError(SQLException e) {
-		return (e.getErrorCode() == 1062);
-	}
+    @Override
+    protected boolean isDuplicatePkError(SQLException e) {
+        return (e.getErrorCode() == 1062);
+    }
+
+
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/SqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/SqlLockManager.java
index 26ec6a2..4813501 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/SqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/optimistic/SqlLockManager.java
@@ -36,231 +36,271 @@
 
 abstract class SqlLockManager extends JdbcLockManager {
 
-	private static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
-	private static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT, VER) VALUES (?, ?, ?, ?, ?)";
-	private static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=?, VER=? WHERE RESOURCE_ID=? AND VER=?";
-//	private static final String SQL_DELETE_LOCK_RECORD = "DELETE FROM %s WHERE RESOURCE_ID=? AND VER=?";
-	private static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
+    private static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
+    private static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT, VER) VALUES (?, ?, ?, ?, ?)";
+    private static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=?, VER=? WHERE RESOURCE_ID=? AND VER=?";
+//    private static final String SQL_DELETE_LOCK_RECORD = "DELETE FROM %s WHERE RESOURCE_ID=? AND VER=?";
+    private static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
+    private static final String SQL_LOAD_LOCK_RECORD_WITH_OWNER = "SELECT * FROM LOCK_MANAGEMENT WHERE RESOURCE_ID = ? AND OWNER = ? ";
 
-	private String sqlLoadLockRecord;
-	private String sqlInsertLockRecord;
-	private String sqlUpdateLockRecord;
-//	private String sqlDeleteLockRecord;
+    private String sqlLoadLockRecord;
+    private String sqlInsertLockRecord;
+    private String sqlUpdateLockRecord;
+//    private String sqlDeleteLockRecord;
 
-	@Override
-	public boolean acquireLock(String resource, String owner) throws LockException {
-		return acquireLock(resource, owner, 0);
-	}
+    @Override
+    public boolean acquireLock(String resource, String owner) throws LockException {
+        return acquireLock(resource, owner, 0);
+    }
 
-	@Override
-	public boolean acquireLock(String resource, String owner, long timeout) throws LockException {
-		if(owner == null) {
-			throw new LockRuntimeException(Messages.ERR_NULL_LOCK_OWNER.format(resource));
-		}
-		boolean res = false;
-		Connection connection = openDbConnection();
-		try {
-			res = lockResource(connection, resource, owner, timeout);
-		} finally {
-			closeDbConnection(connection);
-		}
-		return res;
-	}
+    @Override
+    public boolean acquireLock(String resource, String owner, long timeout) throws LockException {
+        if(owner == null) {
+            throw new LockRuntimeException(Messages.ERR_NULL_LOCK_OWNER.format(resource));
+        }
+        boolean res = false;
+        Connection connection = openDbConnection();
+        try {
+            res = lockResource(connection, resource, owner, timeout);
+        } finally {
+            closeDbConnection(connection);
+        }
+        return res;
+    }
 
-	@Override
-	public void releaseLock(String resource, String owner) throws LockException {
-		Connection connection = openDbConnection();
-		try {
-			unlockResource(connection, resource, owner);
-		} finally {
-			closeDbConnection(connection);
-		}
-	}
-
-	@Override
-	public boolean isLocked(String resource) {
-        Connection connection=openDbConnection();
-		try {
-			LockRecord lockRecord=loadLockRecord(connection,resource);
-			if(lockRecord==null){
-				return false;
-			}else{
-				if(lockRecord.getOwner()==null){
-					return false;
-				}else if(isLockExpired(lockRecord, connection)){
-					return false;
-				}else{
-                    return true;
-                }
-			}
-		} catch (SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
-		}finally {
+    @Override
+    public void releaseLock(String resource, String owner) throws LockException {
+        Connection connection = openDbConnection();
+        try {
+            unlockResource(connection, resource, owner);
+        } finally {
             closeDbConnection(connection);
         }
     }
 
-	private boolean lockResource(Connection connection, String resource, String owner, long timeout) throws LockException {
-		try {
-			boolean res = false;
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			if(lockRecord != null) {
-				// lock record already exists
-				String currentOwner = lockRecord.getOwner();
-				if(currentOwner != null) {
-					if(isLockExpired(lockRecord, connection)) {
-						currentOwner = null;
-					} else if(!owner.equals(currentOwner)) {
-						throw new LockException(Messages.ERR_LOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
-					}
-				}
-				// set new owner on the resource lock record
-				if(!updateLockRecord(connection, resource, owner, timeout, lockRecord.getVer())) {
-					// try again - maybe same owner updated the record
-					lockResource(connection, resource, owner, timeout);
-				}
-				if(currentOwner == null) {
-					// no one locked the resource before
-					res = true;
-				}
-			} else {
-				// resource record does not exist in lock table => create new record
-				try {
-					addLockRecord(connection, resource, owner, timeout);
-					res = true;
-				} catch(SQLException e) {
-					if(isDuplicatePkError(e)) {
-						// try again - maybe same owner inserted the record
-						lockResource(connection, resource, owner, timeout);
-					} else {
-						throw e;
-					}
-				}
-			}
-			return res;
-		} catch(SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_LOCK.format(resource), e);
-		}
-	}
+    @Override
+    public boolean isLocked(String resource) {
+        Connection connection=openDbConnection();
+        try {
+            LockRecord lockRecord=loadLockRecord(connection,resource);
+            if(lockRecord==null){
+                return false;
+            }else{
+                if(lockRecord.getOwner()==null){
+                    return false;
+                }else if(isLockExpired(lockRecord, connection)){
+                    return false;
+                }else{
+                    return true;
+                }
+            }
+        } catch (SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
+        }finally {
+            closeDbConnection(connection);
+        }
+    }
 
-	protected boolean isDuplicatePkError(SQLException e) {
-		return e.getSQLState().startsWith("23");
-	}
+    @Override
+    public String getLockOwner(String resource) {
+        Connection connection=openDbConnection();
+        try {
+            LockRecord lockRecord=loadLockRecord(connection,resource);
+            if(lockRecord==null || lockRecord.getOwner() ==null ){
+                return null;
+            }else{
+                if(isLockExpired(lockRecord, connection)){
+                    return null;
+                }else{
+                    return lockRecord.getOwner();
+                }
+            }
+        } catch (SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
+        }finally {
+            closeDbConnection(connection);
+        }
+    }
 
-	private void unlockResource(Connection connection, String resource, String owner) throws LockException {
-		try {
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			if(lockRecord != null) {
-				// check if expired
-				if(isLockExpired(lockRecord, connection)) {
-					// lock is expired => no lock
-					lockRecord = null;
-				}
-			}
-			if((lockRecord == null) || (lockRecord.getOwner() == null)) {
-				// resource is not locked
-				throw new LockException(Messages.ERR_UNLOCK_NOT_LOCKED.format(resource));
-			}
-			String currentOwner = lockRecord.getOwner();
-			if(!owner.equals(currentOwner)) {
-				throw new LockException(Messages.ERR_UNLOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
+    private boolean lockResource(Connection connection, String resource, String owner, long timeout) throws LockException {
+        try {
+            boolean res = false;
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            if(lockRecord != null) {
+                // lock record already exists
+                String currentOwner = lockRecord.getOwner();
+                if(currentOwner != null) {
+                    if(isLockExpired(lockRecord, connection)) {
+                        currentOwner = null;
+                    } else if(!owner.equals(currentOwner)) {
+                        throw new LockException(Messages.ERR_LOCK_LOCKED_BY_OTHER.format(resource, currentOwner));
+                    }
+                }
+                // set new owner on the resource lock record
+                if(!updateLockRecord(connection, resource, owner, timeout, lockRecord.getVer())) {
+                    // try again - maybe same owner updated the record
+                    lockResource(connection, resource, owner, timeout);
+                }
+                if(currentOwner == null) {
+                    // no one locked the resource before
+                    res = true;
+                }
+            } else {
+                // resource record does not exist in lock table => create new record
+                try {
+                    addLockRecord(connection, resource, owner, timeout);
+                    res = true;
+                } catch(SQLException e) {
+                    if(isDuplicatePkError(e)) {
+                        // try again - maybe same owner inserted the record
+                        lockResource(connection, resource, owner, timeout);
+                    } else {
+                        throw e;
+                    }
+                }
+            }
+            return res;
+        } catch(SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_LOCK.format(resource), e);
+        }
+    }
+
+    protected boolean isDuplicatePkError(SQLException e) {
+        return e.getSQLState().startsWith("23");
+    }
+
+    private void unlockResource(Connection connection, String resource, String owner) throws LockException {
+        try {
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            if(lockRecord != null) {
+                // check if expired
+                if(isLockExpired(lockRecord, connection)) {
+                    // lock is expired => no lock
+                    lockRecord = null;
+                }
+            }
+            if((lockRecord == null) || (lockRecord.getOwner() == null)) {
+                // resource is not locked
+                throw new LockException(Messages.ERR_UNLOCK_NOT_LOCKED.format(resource));
+            }
+            String currentOwner = lockRecord.getOwner();
+            if(!owner.equals(currentOwner)) {
+                throw new LockException(Messages.ERR_UNLOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
             }
             if (!updateLockRecord(connection, resource, null, 0, lockRecord.getVer())) {
-				unlockResource(connection, resource, owner);
-			}
-			// TODO delete record from table on lock release?
-//			deleteLockRecord(connection, resource, lockRecord.getVer());
-		} catch(SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_UNLOCK.format(resource), e);
-		}
-	}
+                unlockResource(connection, resource, owner);
+            }
+            // TODO delete record from table on lock release?
+//            deleteLockRecord(connection, resource, lockRecord.getVer());
+        } catch(SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_UNLOCK.format(resource), e);
+        }
+    }
 
-	protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
-		LockRecord res = null;
-		if(sqlLoadLockRecord == null) {
-			sqlLoadLockRecord = String.format(SQL_LOAD_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlLoadLockRecord)) {
-			statement.setString(1, resource);
-			try(ResultSet resultSet = statement.executeQuery()) {
-				if(resultSet.next()) {
-					res = new LockRecord(resource);
-					res.setOwner(resultSet.getString(2));
-					res.setUpdated(resultSet.getLong(3));
-					res.setTimeout(resultSet.getLong(4));
-					res.setVer(resultSet.getLong(5));
-				}
-			}
-		}
-		return res;
-	}
+    protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
+        LockRecord res = null;
+        if(sqlLoadLockRecord == null) {
+            sqlLoadLockRecord = String.format(SQL_LOAD_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlLoadLockRecord)) {
+            statement.setString(1, resource);
+            try(ResultSet resultSet = statement.executeQuery()) {
+                if(resultSet.next()) {
+                    res = new LockRecord(resource);
+                    res.setOwner(resultSet.getString(2));
+                    res.setUpdated(resultSet.getLong(3));
+                    res.setTimeout(resultSet.getLong(4));
+                    res.setVer(resultSet.getLong(5));
+                }
+            }
+        }
+        return res;
+    }
 
-	protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(sqlInsertLockRecord == null) {
-			sqlInsertLockRecord = String.format(SQL_INSERT_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlInsertLockRecord)) {
-			statement.setString(1, resource);
-			statement.setString(2, owner);
+    protected LockRecord loadLockRecord(Connection connection, String resource,String owner) throws SQLException {
+        LockRecord res = null;
+        try(PreparedStatement statement = connection.prepareStatement(SQL_LOAD_LOCK_RECORD_WITH_OWNER)) {
+            statement.setString(1, resource);
+            statement.setString(2, owner);
+            try(ResultSet resultSet = statement.executeQuery()) {
+                if(resultSet.next()) {
+                    res = new LockRecord(resource);
+                    res.setOwner(resultSet.getString(2));
+                    res.setUpdated(resultSet.getLong(3));
+                    res.setTimeout(resultSet.getLong(4));
+                    res.setVer(resultSet.getLong(5));
+                }
+            }
+        }
+        return res;
+    }
+
+    protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(sqlInsertLockRecord == null) {
+            sqlInsertLockRecord = String.format(SQL_INSERT_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlInsertLockRecord)) {
+            statement.setString(1, resource);
+            statement.setString(2, owner);
             statement.setLong(3, getCurrentTime(connection));
-			statement.setLong(4, timeout);
-			statement.setLong(5, 1);
-			statement.executeUpdate();
-		}
-	}
+            statement.setLong(4, timeout);
+            statement.setLong(5, 1);
+            statement.executeUpdate();
+        }
+    }
 
-	protected boolean updateLockRecord(Connection connection, String resource, String owner, long timeout, long ver) throws SQLException {
-		if(sqlUpdateLockRecord == null) {
-			sqlUpdateLockRecord = String.format(SQL_UPDATE_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlUpdateLockRecord)) {
-			long newVer = (ver >= Long.MAX_VALUE) ? 1 : (ver + 1);
-			statement.setString(1, owner);
+    protected boolean updateLockRecord(Connection connection, String resource, String owner, long timeout, long ver) throws SQLException {
+        if(sqlUpdateLockRecord == null) {
+            sqlUpdateLockRecord = String.format(SQL_UPDATE_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlUpdateLockRecord)) {
+            long newVer = (ver >= Long.MAX_VALUE) ? 1 : (ver + 1);
+            statement.setString(1, owner);
             statement.setLong(2, getCurrentTime(connection));
-			statement.setLong(3, timeout);
-			statement.setLong(4, newVer);
-			statement.setString(5, resource);
-			statement.setLong(6, ver);
-			return (statement.executeUpdate() != 0);
-		}
-	}
+            statement.setLong(3, timeout);
+            statement.setLong(4, newVer);
+            statement.setString(5, resource);
+            statement.setLong(6, ver);
+            return (statement.executeUpdate() != 0);
+        }
+    }
 
-//	protected void deleteLockRecord(Connection connection, String resource, long ver) throws SQLException {
-//		if(sqlDeleteLockRecord == null) {
-//			sqlDeleteLockRecord = String.format(SQL_DELETE_LOCK_RECORD, tableName);
-//		}
-//		try(PreparedStatement statement = connection.prepareStatement(sqlDeleteLockRecord)) {
-//			statement.setString(1, resource);
-//			statement.setLong(2, ver);
-//			statement.executeUpdate();
-//		}
-//	}
+//    protected void deleteLockRecord(Connection connection, String resource, long ver) throws SQLException {
+//        if(sqlDeleteLockRecord == null) {
+//            sqlDeleteLockRecord = String.format(SQL_DELETE_LOCK_RECORD, tableName);
+//        }
+//        try(PreparedStatement statement = connection.prepareStatement(sqlDeleteLockRecord)) {
+//            statement.setString(1, resource);
+//            statement.setLong(2, ver);
+//            statement.executeUpdate();
+//        }
+//    }
 
-	private boolean isLockExpired(LockRecord lockRecord, Connection connection) throws SQLException {
-		long timeout = lockRecord.getTimeout();
-		if(timeout == 0) {
-			return false;
-		}
-		long updated = lockRecord.getUpdated();
+    private boolean isLockExpired(LockRecord lockRecord, Connection connection) throws SQLException {
+        long timeout = lockRecord.getTimeout();
+        if(timeout == 0) {
+            return false;
+        }
+        long updated = lockRecord.getUpdated();
         long now = getCurrentTime(connection);
-		long expiration = updated + timeout;
-		return (now > expiration);
-	}
+        long expiration = updated + timeout;
+        return (now > expiration);
+    }
 
-	private long getCurrentTime(Connection connection) throws SQLException {
-		long res = -1;
-		if(connection != null) {
-			try(PreparedStatement statement = connection.prepareStatement(SQL_CURRENT_TIMESTAMP)) {
-				try(ResultSet resultSet = statement.executeQuery()) {
-					if(resultSet.next()) {
-						res = resultSet.getTimestamp(1).getTime();
-					}
-				}
-			}
-		}
-		if(res == -1) {
-			res = System.currentTimeMillis();
-		}
-		return res;
-	}
+    private long getCurrentTime(Connection connection) throws SQLException {
+        long res = -1;
+        if(connection != null) {
+            try(PreparedStatement statement = connection.prepareStatement(SQL_CURRENT_TIMESTAMP)) {
+                try(ResultSet resultSet = statement.executeQuery()) {
+                    if(resultSet.next()) {
+                        res = resultSet.getTimestamp(1).getTime();
+                    }
+                }
+            }
+        }
+        if(res == -1) {
+            res = System.currentTimeMillis();
+        }
+        return res;
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/LockRecord.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/LockRecord.java
index 1960ba9..3a37996 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/LockRecord.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/LockRecord.java
@@ -26,40 +26,40 @@
 
 class LockRecord {
 
-	private String resource;
-	private String owner;
-	private long updated;
-	private long timeout;
+    private String resource;
+    private String owner;
+    private long updated;
+    private long timeout;
 
-	LockRecord(String resource) {
-		this.resource = resource;
-	}
+    LockRecord(String resource) {
+        this.resource = resource;
+    }
 
-	public String getResource() {
-		return resource;
-	}
+    public String getResource() {
+        return resource;
+    }
 
-	public String getOwner() {
-		return owner;
-	}
+    public String getOwner() {
+        return owner;
+    }
 
-	public void setOwner(String owner) {
-		this.owner = owner;
-	}
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
 
-	public long getUpdated() {
-		return updated;
-	}
+    public long getUpdated() {
+        return updated;
+    }
 
-	public void setUpdated(long updated) {
-		this.updated = updated;
-	}
+    public void setUpdated(long updated) {
+        this.updated = updated;
+    }
 
-	public long getTimeout() {
-		return timeout;
-	}
+    public long getTimeout() {
+        return timeout;
+    }
 
-	public void setTimeout(long timeout) {
-		this.timeout = timeout;
-	}
+    public void setTimeout(long timeout) {
+        this.timeout = timeout;
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManager.java
index b76f15c..5268acf 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManager.java
@@ -33,56 +33,56 @@
 
 public class MySqlLockManager extends SqlLockManager {
 
-	private static final int DEF_CRITICAL_SECTION_WAIT_TIMEOUT = 3;
+    private static final int DEF_CRITICAL_SECTION_WAIT_TIMEOUT = 3;
 
-	protected int criticalSectionWaitTimeoutSecs = DEF_CRITICAL_SECTION_WAIT_TIMEOUT;
+    protected int criticalSectionWaitTimeoutSecs = DEF_CRITICAL_SECTION_WAIT_TIMEOUT;
 
-	public void setCriticalSectionWaitTimeoutSecs(int criticalSectionWaitTimeoutSecs) {
-		this.criticalSectionWaitTimeoutSecs = criticalSectionWaitTimeoutSecs;
-	}
+    public void setCriticalSectionWaitTimeoutSecs(int criticalSectionWaitTimeoutSecs) {
+        this.criticalSectionWaitTimeoutSecs = criticalSectionWaitTimeoutSecs;
+    }
 
-	@Override
-	protected void enterCriticalSection(Connection connection, String resource) {
-		try {
-			CallableStatement statement = connection.prepareCall("SELECT COALESCE(GET_LOCK(?,?),0)");
-			try {
-				statement.setString(1, resource);
-				statement.setInt(2, criticalSectionWaitTimeoutSecs);
-				boolean execRes = statement.execute();
-				int result = 0;
-				if(execRes) {
-					ResultSet resultSet = statement.getResultSet();
-					try {
-						if(resultSet.next()) {
-							result = resultSet.getInt(1);
-						}
-					} finally {
-						resultSet.close();
-					}
-				}
-				if(result != 1) { // lock is not obtained
-					throw new LockRuntimeException("Cannot obtain critical section lock for resource [" + resource + "].");
-				}
-			} finally {
-				statement.close();
-			}
-		} catch(SQLException e) {
+    @Override
+    protected void enterCriticalSection(Connection connection, String resource) {
+        try {
+            CallableStatement statement = connection.prepareCall("SELECT COALESCE(GET_LOCK(?,?),0)");
+            try {
+                statement.setString(1, resource);
+                statement.setInt(2, criticalSectionWaitTimeoutSecs);
+                boolean execRes = statement.execute();
+                int result = 0;
+                if(execRes) {
+                    ResultSet resultSet = statement.getResultSet();
+                    try {
+                        if(resultSet.next()) {
+                            result = resultSet.getInt(1);
+                        }
+                    } finally {
+                        resultSet.close();
+                    }
+                }
+                if(result != 1) { // lock is not obtained
+                    throw new LockRuntimeException("Cannot obtain critical section lock for resource [" + resource + "].");
+                }
+            } finally {
+                statement.close();
+            }
+        } catch(SQLException e) {
             throw new LockRuntimeException("Cannot obtain critical section lock for resource [" + resource + "].", e);
-		}
-	}
+        }
+    }
 
-	@Override
-	protected void leaveCriticalSection(Connection connection, String resource) {
-		try {
-			CallableStatement statement = connection.prepareCall("SELECT RELEASE_LOCK(?)");
-			try {
-				statement.setString(1, resource);
-				statement.execute();
-			} finally {
-				statement.close();
-			}
-		} catch(SQLException e) {
-			throw new LockRuntimeException("Error releasing critical section lock.", e);
-		}
-	}
+    @Override
+    protected void leaveCriticalSection(Connection connection, String resource) {
+        try {
+            CallableStatement statement = connection.prepareCall("SELECT RELEASE_LOCK(?)");
+            try {
+                statement.setString(1, resource);
+                statement.execute();
+            } finally {
+                statement.close();
+            }
+        } catch(SQLException e) {
+            throw new LockRuntimeException("Error releasing critical section lock.", e);
+        }
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
index a1536d9..98c7536 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/main/java/org/onap/appc/lockmanager/impl/sql/pessimistic/SqlLockManager.java
@@ -36,219 +36,240 @@
 
 abstract class SqlLockManager extends JdbcLockManager {
 
-	private static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
-	private static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT) VALUES (?, ?, ?, ?)";
-	private static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=? WHERE RESOURCE_ID=?";
-	private static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
+    private static final String SQL_LOAD_LOCK_RECORD = "SELECT * FROM %s WHERE RESOURCE_ID=?";
+    private static final String SQL_INSERT_LOCK_RECORD = "INSERT INTO %s (RESOURCE_ID, OWNER_ID, UPDATED, TIMEOUT) VALUES (?, ?, ?, ?)";
+    private static final String SQL_UPDATE_LOCK_RECORD = "UPDATE %s SET OWNER_ID=?, UPDATED=?, TIMEOUT=? WHERE RESOURCE_ID=?";
+    private static final String SQL_CURRENT_TIMESTAMP = "SELECT CURRENT_TIMESTAMP()";
 
-	private String sqlLoadLockRecord;
-	private String sqlInsertLockRecord;
-	private String sqlUpdateLockRecord;
+    private String sqlLoadLockRecord;
+    private String sqlInsertLockRecord;
+    private String sqlUpdateLockRecord;
 
-	@Override
-	public boolean acquireLock(String resource, String owner) throws LockException {
-		return acquireLock(resource, owner, 0);
-	}
+    @Override
+    public boolean acquireLock(String resource, String owner) throws LockException {
+        return acquireLock(resource, owner, 0);
+    }
 
-	@Override
-	public boolean acquireLock(String resource, String owner, long timeout) throws LockException {
-		if(owner == null) {
-			throw new LockRuntimeException(Messages.ERR_NULL_LOCK_OWNER.format(resource));
-		}
-		boolean res = false;
-		Connection connection = openDbConnection();
-		try {
-			enterCriticalSection(connection, resource);
-			try {
-				res = lockResource(connection, resource, owner, timeout);
-			} finally {
-				leaveCriticalSection(connection, resource);
-			}
-		} finally {
-			closeDbConnection(connection);
-		}
-		return res;
-	}
+    @Override
+    public boolean acquireLock(String resource, String owner, long timeout) throws LockException {
+        if(owner == null) {
+            throw new LockRuntimeException(Messages.ERR_NULL_LOCK_OWNER.format(resource));
+        }
+        boolean res = false;
+        Connection connection = openDbConnection();
+        try {
+            enterCriticalSection(connection, resource);
+            try {
+                res = lockResource(connection, resource, owner, timeout);
+            } finally {
+                leaveCriticalSection(connection, resource);
+            }
+        } finally {
+            closeDbConnection(connection);
+        }
+        return res;
+    }
 
-	@Override
-	public void releaseLock(String resource, String owner) throws LockException {
-		Connection connection = openDbConnection();
-		try {
-			enterCriticalSection(connection, resource);
-			try {
-				unlockResource(connection, resource, owner);
-			} finally {
-				leaveCriticalSection(connection, resource);
-			}
-		} finally {
-			closeDbConnection(connection);
-		}
-	}
+    @Override
+    public void releaseLock(String resource, String owner) throws LockException {
+        Connection connection = openDbConnection();
+        try {
+            enterCriticalSection(connection, resource);
+            try {
+                unlockResource(connection, resource, owner);
+            } finally {
+                leaveCriticalSection(connection, resource);
+            }
+        } finally {
+            closeDbConnection(connection);
+        }
+    }
 
-	@Override
-	public boolean isLocked(String resource) {
-		Connection connection=openDbConnection();
-		try {
-			LockRecord lockRecord=loadLockRecord(connection,resource);
-			if(lockRecord==null){
-				return false;
-			}else{
-				if(lockRecord.getOwner()==null){
-					return false;
-				}else if(isLockExpired(lockRecord, connection)){
-					return false;
-				}else{
-					return true;
-				}
-			}
-		} catch (SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
-		}finally {
-			closeDbConnection(connection);
-		}
-	}
+    @Override
+    public boolean isLocked(String resource) {
+        Connection connection=openDbConnection();
+        try {
+            LockRecord lockRecord=loadLockRecord(connection,resource);
+            if(lockRecord==null){
+                return false;
+            }else{
+                if(lockRecord.getOwner()==null){
+                    return false;
+                }else if(isLockExpired(lockRecord, connection)){
+                    return false;
+                }else{
+                    return true;
+                }
+            }
+        } catch (SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
+        }finally {
+            closeDbConnection(connection);
+        }
+    }
 
-	private boolean lockResource(Connection connection, String resource, String owner, long timeout) throws LockException {
-		try {
-			boolean res = false;
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			if(lockRecord != null) {
-				// lock record already exists
-				String currentOwner = lockRecord.getOwner();
-				if(currentOwner != null) {
-					if(isLockExpired(lockRecord, connection)) {
-						currentOwner = null;
-					} else if(!owner.equals(currentOwner)) {
-						throw new LockException(Messages.ERR_LOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
-					}
-				}
-				// set new owner on the resource lock record
-				updateLockRecord(connection, resource, owner, timeout);
-				if(currentOwner == null) {
-					// no one locked the resource before
-					res = true;
-				}
-			} else {
-				// resource record does not exist in lock table => create new record
-				addLockRecord(connection, resource, owner, timeout);
-				res = true;
-			}
-			return res;
-		} catch(SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_LOCK.format(resource), e);
-		}
-	}
+    @Override
+    public String getLockOwner(String resource) {
+        Connection connection=openDbConnection();
+        try {
+            org.onap.appc.lockmanager.impl.sql.pessimistic.LockRecord lockRecord=loadLockRecord(connection,resource);
+            if(lockRecord==null || lockRecord.getOwner() ==null ){
+                return null;
+            }else{
+                if(isLockExpired(lockRecord, connection)){
+                    return null;
+                }else{
+                    return lockRecord.getOwner();
+                }
+            }
+        } catch (SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_CHECK_LOCK.format(resource));
+        }finally {
+            closeDbConnection(connection);
+        }
+    }
 
-	private void unlockResource(Connection connection, String resource, String owner) throws LockException {
-		try {
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			if(lockRecord != null) {
-				// check if expired
-				if(isLockExpired(lockRecord, connection)) {
-					// lock is expired => no lock
-					lockRecord = null;
-				}
-			}
-			if((lockRecord == null) || (lockRecord.getOwner() == null)) {
-				// resource is not locked
-				throw new LockException(Messages.ERR_UNLOCK_NOT_LOCKED.format(resource));
-			}
-			String currentOwner = lockRecord.getOwner();
-			if(!owner.equals(currentOwner)) {
-				throw new LockException(Messages.ERR_UNLOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
-			}
-			updateLockRecord(connection, resource, null, 0);
-			// TODO delete record from table on lock release?
-//			deleteLockRecord(connection, resource);
-		} catch(SQLException e) {
-			throw new LockRuntimeException(Messages.EXP_UNLOCK.format(resource), e);
-		}
-	}
+    private boolean lockResource(Connection connection, String resource, String owner, long timeout) throws LockException {
+        try {
+            boolean res = false;
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            if(lockRecord != null) {
+                // lock record already exists
+                String currentOwner = lockRecord.getOwner();
+                if(currentOwner != null) {
+                    if(isLockExpired(lockRecord, connection)) {
+                        currentOwner = null;
+                    } else if(!owner.equals(currentOwner)) {
+                        throw new LockException(Messages.ERR_LOCK_LOCKED_BY_OTHER.format(resource, currentOwner));
+                    }
+                }
+                // set new owner on the resource lock record
+                updateLockRecord(connection, resource, owner, timeout);
+                if(currentOwner == null) {
+                    // no one locked the resource before
+                    res = true;
+                }
+            } else {
+                // resource record does not exist in lock table => create new record
+                addLockRecord(connection, resource, owner, timeout);
+                res = true;
+            }
+            return res;
+        } catch(SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_LOCK.format(resource), e);
+        }
+    }
 
-	protected abstract void enterCriticalSection(Connection connection, String resource);
+    private void unlockResource(Connection connection, String resource, String owner) throws LockException {
+        try {
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            if(lockRecord != null) {
+                // check if expired
+                if(isLockExpired(lockRecord, connection)) {
+                    // lock is expired => no lock
+                    lockRecord = null;
+                }
+            }
+            if((lockRecord == null) || (lockRecord.getOwner() == null)) {
+                // resource is not locked
+                throw new LockException(Messages.ERR_UNLOCK_NOT_LOCKED.format(resource));
+            }
+            String currentOwner = lockRecord.getOwner();
+            if(!owner.equals(currentOwner)) {
+                throw new LockException(Messages.ERR_UNLOCK_LOCKED_BY_OTHER.format(resource, owner, currentOwner));
+            }
+            updateLockRecord(connection, resource, null, 0);
+            // TODO delete record from table on lock release?
+//            deleteLockRecord(connection, resource);
+        } catch(SQLException e) {
+            throw new LockRuntimeException(Messages.EXP_UNLOCK.format(resource), e);
+        }
+    }
 
-	protected abstract void leaveCriticalSection(Connection connection, String resource);
+    protected abstract void enterCriticalSection(Connection connection, String resource);
 
-	protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
-		LockRecord res = null;
-		if(sqlLoadLockRecord == null) {
-			sqlLoadLockRecord = String.format(SQL_LOAD_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlLoadLockRecord)) {
-			statement.setString(1, resource);
-			try(ResultSet resultSet = statement.executeQuery()) {
-				if(resultSet.next()) {
-					res = new LockRecord(resource);
-					res.setOwner(resultSet.getString(2));
-					res.setUpdated(resultSet.getLong(3));
-					res.setTimeout(resultSet.getLong(4));
-				}
-			}
-		}
-		return res;
-	}
+    protected abstract void leaveCriticalSection(Connection connection, String resource);
 
-	protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(sqlInsertLockRecord == null) {
-			sqlInsertLockRecord = String.format(SQL_INSERT_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlInsertLockRecord)) {
-			statement.setString(1, resource);
-			statement.setString(2, owner);
-			statement.setLong(3, getCurrentTime(connection));
-			statement.setLong(4, timeout);
-			statement.executeUpdate();
-		}
-	}
+    protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
+        LockRecord res = null;
+        if(sqlLoadLockRecord == null) {
+            sqlLoadLockRecord = String.format(SQL_LOAD_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlLoadLockRecord)) {
+            statement.setString(1, resource);
+            try(ResultSet resultSet = statement.executeQuery()) {
+                if(resultSet.next()) {
+                    res = new LockRecord(resource);
+                    res.setOwner(resultSet.getString(2));
+                    res.setUpdated(resultSet.getLong(3));
+                    res.setTimeout(resultSet.getLong(4));
+                }
+            }
+        }
+        return res;
+    }
 
-	protected void updateLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(sqlUpdateLockRecord == null) {
-			sqlUpdateLockRecord = String.format(SQL_UPDATE_LOCK_RECORD, tableName);
-		}
-		try(PreparedStatement statement = connection.prepareStatement(sqlUpdateLockRecord)) {
-			statement.setString(1, owner);
-			statement.setLong(2, getCurrentTime(connection));
-			statement.setLong(3, timeout);
-			statement.setString(4, resource);
-			statement.executeUpdate();
-		}
-	}
+    protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(sqlInsertLockRecord == null) {
+            sqlInsertLockRecord = String.format(SQL_INSERT_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlInsertLockRecord)) {
+            statement.setString(1, resource);
+            statement.setString(2, owner);
+            statement.setLong(3, getCurrentTime(connection));
+            statement.setLong(4, timeout);
+            statement.executeUpdate();
+        }
+    }
 
-//	protected void deleteLockRecord(Connection connection, String resource) throws SQLException {
-//		if(sqlDeleteLockRecord == null) {
-//			sqlDeleteLockRecord = String.format(SQL_DELETE_LOCK_RECORD, tableName);
-//		}
-//		try(PreparedStatement statement = connection.prepareStatement(sqlDeleteLockRecord)) {
-//			statement.setString(1, resource);
-//			statement.executeUpdate();
-//		}
-//	}
+    protected void updateLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(sqlUpdateLockRecord == null) {
+            sqlUpdateLockRecord = String.format(SQL_UPDATE_LOCK_RECORD, tableName);
+        }
+        try(PreparedStatement statement = connection.prepareStatement(sqlUpdateLockRecord)) {
+            statement.setString(1, owner);
+            statement.setLong(2, getCurrentTime(connection));
+            statement.setLong(3, timeout);
+            statement.setString(4, resource);
+            statement.executeUpdate();
+        }
+    }
 
-	private boolean isLockExpired(LockRecord lockRecord, Connection connection) throws SQLException {
-		long timeout = lockRecord.getTimeout();
-		if(timeout == 0) {
-			return false;
-		}
-		long updated = lockRecord.getUpdated();
-		long now = getCurrentTime(connection);
-		long expiration = updated + timeout;
-		return (now > expiration);
-	}
+//    protected void deleteLockRecord(Connection connection, String resource) throws SQLException {
+//        if(sqlDeleteLockRecord == null) {
+//            sqlDeleteLockRecord = String.format(SQL_DELETE_LOCK_RECORD, tableName);
+//        }
+//        try(PreparedStatement statement = connection.prepareStatement(sqlDeleteLockRecord)) {
+//            statement.setString(1, resource);
+//            statement.executeUpdate();
+//        }
+//    }
 
-	private long getCurrentTime(Connection connection) throws SQLException {
-		long res = -1;
-		if(connection != null) {
-			try(PreparedStatement statement = connection.prepareStatement(SQL_CURRENT_TIMESTAMP)) {
-				try(ResultSet resultSet = statement.executeQuery()) {
-					if(resultSet.next()) {
-						res = resultSet.getTimestamp(1).getTime();
-					}
-				}
-			}
-		}
-		if(res == -1) {
-			res = System.currentTimeMillis();
-		}
-		return res;
-	}
+    private boolean isLockExpired(LockRecord lockRecord, Connection connection) throws SQLException {
+        long timeout = lockRecord.getTimeout();
+        if(timeout == 0) {
+            return false;
+        }
+        long updated = lockRecord.getUpdated();
+        long now = getCurrentTime(connection);
+        long expiration = updated + timeout;
+        return (now > expiration);
+    }
+
+    private long getCurrentTime(Connection connection) throws SQLException {
+        long res = -1;
+        if(connection != null) {
+            try(PreparedStatement statement = connection.prepareStatement(SQL_CURRENT_TIMESTAMP)) {
+                try(ResultSet resultSet = statement.executeQuery()) {
+                    if(resultSet.next()) {
+                        res = resultSet.getTimestamp(1).getTime();
+                    }
+                }
+            }
+        }
+        if(res == -1) {
+            res = System.currentTimeMillis();
+        }
+        return res;
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/api/LockManagerBaseTests.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/api/LockManagerBaseTests.java
index 9f7e84c..8a53372 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/api/LockManagerBaseTests.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/api/LockManagerBaseTests.java
@@ -32,139 +32,139 @@
 
 public abstract class LockManagerBaseTests {
 
-	protected enum Resource {Resource1, Resource2};
-	protected enum Owner {A, B};
+    protected enum Resource {Resource1, Resource2};
+    protected enum Owner {A, B};
 
-	protected LockManager lockManager;
+    protected LockManager lockManager;
 
-	@Before
-	public void beforeTest() {
-		lockManager = createLockManager();
-	}
+    @Before
+    public void beforeTest() {
+        lockManager = createLockManager();
+    }
 
-	protected abstract LockManager createLockManager();
+    protected abstract LockManager createLockManager();
 
-	@Test
-	public void testAcquireLock() throws LockException {
-		boolean lockRes = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		try {
-			Assert.assertTrue(lockRes);
-		} finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test
+    public void testAcquireLock() throws LockException {
+        boolean lockRes = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        try {
+            Assert.assertTrue(lockRes);
+        } finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test
-	public void testAcquireLock_AlreadyLockedBySameOwner() throws LockException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		try {
-			Assert.assertTrue(lockRes1);
-			boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-			Assert.assertFalse(lockRes2);
-		} finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test
+    public void testAcquireLock_AlreadyLockedBySameOwner() throws LockException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        try {
+            Assert.assertTrue(lockRes1);
+            boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+            Assert.assertFalse(lockRes2);
+        } finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test(expected = LockException.class)
-	public void testAcquireLock_AlreadyLockedByOtherOwner() throws LockException {
-		String owner2 = "B";
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		try {
-			Assert.assertTrue(lockRes1);
-			boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), owner2);
-			Assert.assertFalse(lockRes2);
-		} finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test(expected = LockException.class)
+    public void testAcquireLock_AlreadyLockedByOtherOwner() throws LockException {
+        String owner2 = "B";
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        try {
+            Assert.assertTrue(lockRes1);
+            boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), owner2);
+            Assert.assertFalse(lockRes2);
+        } finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test
-	public void testAcquireLock_LockDifferentResources() throws LockException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		try {
-			Assert.assertTrue(lockRes1);
-			boolean lockRes2 = lockManager.acquireLock(Resource.Resource2.name(), Owner.B.name());
-			try {
-				Assert.assertTrue(lockRes2);
-			} finally {
-				lockManager.releaseLock(Resource.Resource2.name(), Owner.B.name());
-			}
-		} finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test
+    public void testAcquireLock_LockDifferentResources() throws LockException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        try {
+            Assert.assertTrue(lockRes1);
+            boolean lockRes2 = lockManager.acquireLock(Resource.Resource2.name(), Owner.B.name());
+            try {
+                Assert.assertTrue(lockRes2);
+            } finally {
+                lockManager.releaseLock(Resource.Resource2.name(), Owner.B.name());
+            }
+        } finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test(expected = LockException.class)
-	public void testReleaseLock_NotLockedResource() throws LockException {
-		lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-	}
+    @Test(expected = LockException.class)
+    public void testReleaseLock_NotLockedResource() throws LockException {
+        lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+    }
 
-	@Test(expected = LockException.class)
-	public void testReleaseLock_LockedByOtherOwnerResource() throws LockException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		try {
-			Assert.assertTrue(lockRes1);
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.B.name());
-		} finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test(expected = LockException.class)
+    public void testReleaseLock_LockedByOtherOwnerResource() throws LockException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        try {
+            Assert.assertTrue(lockRes1);
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.B.name());
+        } finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test(expected = LockException.class)
-	public void testAcquireLock_LockExpired() throws LockException, InterruptedException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
-		Assert.assertTrue(lockRes1);
-		Thread.sleep(1000);
-		lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-	}
+    @Test(expected = LockException.class)
+    public void testAcquireLock_LockExpired() throws LockException, InterruptedException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
+        Assert.assertTrue(lockRes1);
+        Thread.sleep(1000);
+        lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+    }
 
-	@Test
-	public void testAcquireLock_OtherLockExpired() throws LockException, InterruptedException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
-		Assert.assertTrue(lockRes1);
-		Thread.sleep(1000);
-		boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), Owner.B.name());
-		try {
-			Assert.assertTrue(lockRes2);
-		}finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.B.name());
-		}
-	}
+    @Test
+    public void testAcquireLock_OtherLockExpired() throws LockException, InterruptedException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
+        Assert.assertTrue(lockRes1);
+        Thread.sleep(1000);
+        boolean lockRes2 = lockManager.acquireLock(Resource.Resource1.name(), Owner.B.name());
+        try {
+            Assert.assertTrue(lockRes2);
+        }finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.B.name());
+        }
+    }
 
-	@Test
-	public void testIsLocked_WhenLocked() throws LockException, InterruptedException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
-		try {
-		Assert.assertTrue(lockManager.isLocked(Resource.Resource1.name()));
-		}finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    @Test
+    public void testIsLocked_WhenLocked() throws LockException, InterruptedException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
+        try {
+        Assert.assertTrue(lockManager.isLocked(Resource.Resource1.name()));
+        }finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
 
     @Test(expected = LockException.class)
-	public void testIsLocked_LockExpired() throws LockException, InterruptedException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
-		Assert.assertTrue(lockRes1);
-		Assert.assertTrue(lockManager.isLocked(Resource.Resource1.name()));
-		Thread.sleep(1000);
-		try {
-			Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
-		}finally {
-			lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+    public void testIsLocked_LockExpired() throws LockException, InterruptedException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
+        Assert.assertTrue(lockRes1);
+        Assert.assertTrue(lockManager.isLocked(Resource.Resource1.name()));
+        Thread.sleep(1000);
+        try {
+            Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
+        }finally {
+            lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        }
+    }
 
-	@Test
-	public void testIsLocked_LockReleased() throws LockException, InterruptedException {
-		boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
-		lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
-	}
+    @Test
+    public void testIsLocked_LockReleased() throws LockException, InterruptedException {
+        boolean lockRes1 = lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name(), 50);
+        lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+        Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
+    }
 
-	@Test
-	public void testIsLocked_NoLock() throws LockException, InterruptedException {
-		Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
-	}
+    @Test
+    public void testIsLocked_NoLock() throws LockException, InterruptedException {
+        Assert.assertFalse(lockManager.isLocked(Resource.Resource1.name()));
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/MySqlLockManagerBaseTests.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/MySqlLockManagerBaseTests.java
index b8cd95b..12b587b 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/MySqlLockManagerBaseTests.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/MySqlLockManagerBaseTests.java
@@ -38,59 +38,59 @@
 
 public abstract class MySqlLockManagerBaseTests extends LockManagerBaseTests {
 
-	private static final boolean USE_REAL_DB = Boolean.getBoolean("lockmanager.tests.useRealDb");
-	private static final String TABLE_LOCK_MANAGEMENT = "TEST_LOCK_MANAGEMENT";
-	private static final String JDBC_URL = System.getProperty("lockmanager.tests.jdbcUrl", "jdbc:mysql://192.168.1.2/test");
-	private static final String JDBC_USERNAME = System.getProperty("lockmanager.tests.jdbcUsername", "test");
-	private static final String JDBC_PASSWORD = System.getProperty("lockmanager.tests.jdbcPassword", "123456");
+    private static final boolean USE_REAL_DB = Boolean.getBoolean("lockmanager.tests.useRealDb");
+    private static final String TABLE_LOCK_MANAGEMENT = "TEST_LOCK_MANAGEMENT";
+    private static final String JDBC_URL = System.getProperty("lockmanager.tests.jdbcUrl", "jdbc:mysql://192.168.1.2/test");
+    private static final String JDBC_USERNAME = System.getProperty("lockmanager.tests.jdbcUsername", "test");
+    private static final String JDBC_PASSWORD = System.getProperty("lockmanager.tests.jdbcPassword", "123456");
 
-	protected static final int CONCURRENT_TEST_WAIT_TIME = 10; // secs
+    protected static final int CONCURRENT_TEST_WAIT_TIME = 10; // secs
 
-	@Rule
-	public TestName testName = new TestName();
+    @Rule
+    public TestName testName = new TestName();
 
-	@Override
-	protected LockManager createLockManager() {
-		JdbcLockManager jdbcLockManager = createJdbcLockManager(USE_REAL_DB);
-		DefaultJdbcConnectionFactory connectionFactory = new MySqlConnectionFactory();
-		connectionFactory.setJdbcURL(JDBC_URL);
-		connectionFactory.setJdbcUserName(JDBC_USERNAME);
-		connectionFactory.setJdbcPassword(JDBC_PASSWORD);
-		jdbcLockManager.setConnectionFactory(connectionFactory);
-		jdbcLockManager.setTableName(TABLE_LOCK_MANAGEMENT);
-		System.out.println("=> Running LockManager test [" + jdbcLockManager.getClass().getName() + "." + testName.getMethodName() + "]" + (USE_REAL_DB ? ". JDBC URL is [" + JDBC_URL + "]" : ""));
-		clearTestLocks(jdbcLockManager);
-		return jdbcLockManager;
-	}
+    @Override
+    protected LockManager createLockManager() {
+        JdbcLockManager jdbcLockManager = createJdbcLockManager(USE_REAL_DB);
+        DefaultJdbcConnectionFactory connectionFactory = new MySqlConnectionFactory();
+        connectionFactory.setJdbcURL(JDBC_URL);
+        connectionFactory.setJdbcUserName(JDBC_USERNAME);
+        connectionFactory.setJdbcPassword(JDBC_PASSWORD);
+        jdbcLockManager.setConnectionFactory(connectionFactory);
+        jdbcLockManager.setTableName(TABLE_LOCK_MANAGEMENT);
+        System.out.println("=> Running LockManager test [" + jdbcLockManager.getClass().getName() + "." + testName.getMethodName() + "]" + (USE_REAL_DB ? ". JDBC URL is [" + JDBC_URL + "]" : ""));
+        clearTestLocks(jdbcLockManager);
+        return jdbcLockManager;
+    }
 
-	protected abstract JdbcLockManager createJdbcLockManager(boolean useRealDb);
+    protected abstract JdbcLockManager createJdbcLockManager(boolean useRealDb);
 
-	protected boolean setSynchronizer(Synchronizer synchronizer) {
-		if(!(lockManager instanceof SynchronizerReceiver)) {
-			System.err.println("Skipping concurrency test [" + testName.getMethodName() + "] for LockManager of type " + lockManager.getClass());
-			return false;
-		}
-		((SynchronizerReceiver)lockManager).setSynchronizer(synchronizer);
-		return true;
-	}
+    protected boolean setSynchronizer(Synchronizer synchronizer) {
+        if(!(lockManager instanceof SynchronizerReceiver)) {
+            System.err.println("Skipping concurrency test [" + testName.getMethodName() + "] for LockManager of type " + lockManager.getClass());
+            return false;
+        }
+        ((SynchronizerReceiver)lockManager).setSynchronizer(synchronizer);
+        return true;
+    }
 
-	private static final String SQL_DELETE_LOCK_RECORD = String.format("DELETE FROM %s WHERE RESOURCE_ID=?", TABLE_LOCK_MANAGEMENT);
-	private void clearTestLocks(JdbcLockManager jdbcLockManager) {
-		Connection connection = jdbcLockManager.openDbConnection();
-		if(connection == null) {
-			return;
-		}
-		try {
-			for(Resource resource: Resource.values()) {
-				try(PreparedStatement statement = connection.prepareStatement(SQL_DELETE_LOCK_RECORD)) {
-					statement.setString(1, resource.name());
-					statement.executeUpdate();
-				}
-			}
-		} catch(SQLException e) {
-			throw new RuntimeException("Cannot clear test resources in table", e);
-		} finally {
-			jdbcLockManager.closeDbConnection(connection);
-		}
-	}
+    private static final String SQL_DELETE_LOCK_RECORD = String.format("DELETE FROM %s WHERE RESOURCE_ID=?", TABLE_LOCK_MANAGEMENT);
+    private void clearTestLocks(JdbcLockManager jdbcLockManager) {
+        Connection connection = jdbcLockManager.openDbConnection();
+        if(connection == null) {
+            return;
+        }
+        try {
+            for(Resource resource: Resource.values()) {
+                try(PreparedStatement statement = connection.prepareStatement(SQL_DELETE_LOCK_RECORD)) {
+                    statement.setString(1, resource.name());
+                    statement.executeUpdate();
+                }
+            }
+        } catch(SQLException e) {
+            throw new RuntimeException("Cannot clear test resources in table", e);
+        } finally {
+            jdbcLockManager.closeDbConnection(connection);
+        }
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManagerMock.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManagerMock.java
index f9c072e..076e233 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManagerMock.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/MySqlLockManagerMock.java
@@ -36,100 +36,100 @@
 
 class MySqlLockManagerMock extends MySqlLockManager implements SynchronizerReceiver {
 
-	private final ConcurrentMap<String, LockRecord> locks = new ConcurrentHashMap<>();
-	private boolean useReal;
-	private Synchronizer synchronizer;
+    private final ConcurrentMap<String, LockRecord> locks = new ConcurrentHashMap<>();
+    private boolean useReal;
+    private Synchronizer synchronizer;
 
-	MySqlLockManagerMock(boolean useReal) {
-		this.useReal = useReal;
-	}
+    MySqlLockManagerMock(boolean useReal) {
+        this.useReal = useReal;
+    }
 
-	@Override
-	public void setSynchronizer(Synchronizer synchronizer) {
-		this.synchronizer = synchronizer;
-	}
+    @Override
+    public void setSynchronizer(Synchronizer synchronizer) {
+        this.synchronizer = synchronizer;
+    }
 
-	@Override
-	protected Connection openDbConnection() {
-		if(useReal) {
-			return super.openDbConnection();
-		}
-		return null;
-	}
+    @Override
+    protected Connection openDbConnection() {
+        if(useReal) {
+            return super.openDbConnection();
+        }
+        return null;
+    }
 
-	@Override
-	protected void closeDbConnection(Connection connection) {
-		if(useReal) {
-			super.closeDbConnection(connection);
-		}
-	}
+    @Override
+    protected void closeDbConnection(Connection connection) {
+        if(useReal) {
+            super.closeDbConnection(connection);
+        }
+    }
 
-	@Override
-	protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
-		LockRecord res;
-		if(useReal) {
-			res = super.loadLockRecord(connection, resource);
-		} else {
-			res = locks.get(resource);
-		}
-		if(synchronizer != null) {
-			synchronizer.postLoadLockRecord(resource, (res == null) ? null : res.getOwner());
-		}
-		return res;
-	}
+    @Override
+    protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
+        LockRecord res;
+        if(useReal) {
+            res = super.loadLockRecord(connection, resource);
+        } else {
+            res = locks.get(resource);
+        }
+        if(synchronizer != null) {
+            synchronizer.postLoadLockRecord(resource, (res == null) ? null : res.getOwner());
+        }
+        return res;
+    }
 
-	@Override
-	protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(synchronizer != null) {
-			synchronizer.preAddLockRecord(resource, owner);
-		}
-		try {
-			if(useReal) {
-				super.addLockRecord(connection, resource, owner, timeout);
-				return;
-			}
-			LockRecord lockRecord = new LockRecord(resource);
-			lockRecord.setOwner(owner);
-			lockRecord.setUpdated(System.currentTimeMillis());
-			lockRecord.setTimeout(timeout);
-			lockRecord.setVer(1);
-			LockRecord prevLockRecord = locks.putIfAbsent(resource, lockRecord);
-			if(prevLockRecord != null) {
-				// simulate unique constraint violation
-				throw new SQLException("Duplicate PK exception", "23000", 1062);
-			}
-		} finally {
-			if(synchronizer != null) {
-				synchronizer.postAddLockRecord(resource, owner);
-			}
-		}
-	}
+    @Override
+    protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(synchronizer != null) {
+            synchronizer.preAddLockRecord(resource, owner);
+        }
+        try {
+            if(useReal) {
+                super.addLockRecord(connection, resource, owner, timeout);
+                return;
+            }
+            LockRecord lockRecord = new LockRecord(resource);
+            lockRecord.setOwner(owner);
+            lockRecord.setUpdated(System.currentTimeMillis());
+            lockRecord.setTimeout(timeout);
+            lockRecord.setVer(1);
+            LockRecord prevLockRecord = locks.putIfAbsent(resource, lockRecord);
+            if(prevLockRecord != null) {
+                // simulate unique constraint violation
+                throw new SQLException("Duplicate PK exception", "23000", 1062);
+            }
+        } finally {
+            if(synchronizer != null) {
+                synchronizer.postAddLockRecord(resource, owner);
+            }
+        }
+    }
 
-	@Override
-	protected boolean updateLockRecord(Connection connection, String resource, String owner, long timeout, long ver) throws SQLException {
-		if(synchronizer != null) {
-			synchronizer.preUpdateLockRecord(resource, owner);
-		}
-		try {
-			if(useReal) {
-				return super.updateLockRecord(connection, resource, owner, timeout, ver);
-			}
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			synchronized(lockRecord) {
-				// should be atomic operation
-				if(ver != lockRecord.getVer()) {
-					return false;
-				}
-				lockRecord.setOwner(owner);
-				lockRecord.setUpdated(System.currentTimeMillis());
-				lockRecord.setTimeout(timeout);
-				lockRecord.setVer(ver + 1);
-			}
-			return true;
-		} finally {
-			if(synchronizer != null) {
-				synchronizer.postUpdateLockRecord(resource, owner);
-			}
-		}
-	}
+    @Override
+    protected boolean updateLockRecord(Connection connection, String resource, String owner, long timeout, long ver) throws SQLException {
+        if(synchronizer != null) {
+            synchronizer.preUpdateLockRecord(resource, owner);
+        }
+        try {
+            if(useReal) {
+                return super.updateLockRecord(connection, resource, owner, timeout, ver);
+            }
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            synchronized(lockRecord) {
+                // should be atomic operation
+                if(ver != lockRecord.getVer()) {
+                    return false;
+                }
+                lockRecord.setOwner(owner);
+                lockRecord.setUpdated(System.currentTimeMillis());
+                lockRecord.setTimeout(timeout);
+                lockRecord.setVer(ver + 1);
+            }
+            return true;
+        } finally {
+            if(synchronizer != null) {
+                synchronizer.postUpdateLockRecord(resource, owner);
+            }
+        }
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/TestMySqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/TestMySqlLockManager.java
index d652c75..1ab1e4e 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/TestMySqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/optimistic/TestMySqlLockManager.java
@@ -35,196 +35,196 @@
 
 public class TestMySqlLockManager extends MySqlLockManagerBaseTests {
 
-	@Override
-	protected JdbcLockManager createJdbcLockManager(boolean useReal) {
-		return new MySqlLockManagerMock(useReal);
-	}
+    @Override
+    protected JdbcLockManager createJdbcLockManager(boolean useReal) {
+        return new MySqlLockManagerMock(useReal);
+    }
 
-	@Test
-	public void testConcurrentLockDifferentOwners() throws LockException, InterruptedException, ExecutionException, TimeoutException {
+    @Test
+    public void testConcurrentLockDifferentOwners() throws LockException, InterruptedException, ExecutionException, TimeoutException {
 
-		final int participantsNo = 2;
-		Synchronizer synchronizer = new Synchronizer(participantsNo) {
+        final int participantsNo = 2;
+        Synchronizer synchronizer = new Synchronizer(participantsNo) {
 
-			private boolean wait = true;
+            private boolean wait = true;
 
-			@Override
-			public void preAddLockRecord(String resource, String owner) {
-				if(Owner.A.name().equals(owner)) {
-					synchronized(this) {
-						if(wait) {
-							waitOn(this);
-						}
-					}
-				}
-			}
+            @Override
+            public void preAddLockRecord(String resource, String owner) {
+                if(Owner.A.name().equals(owner)) {
+                    synchronized(this) {
+                        if(wait) {
+                            waitOn(this);
+                        }
+                    }
+                }
+            }
 
-			@Override
-			public void postAddLockRecord(String resource, String owner) {
-				if(!Owner.A.name().equals(owner)) {
-					synchronized(this) {
-						notifyAll();
-						wait = false;
-					}
-				}
-			}
+            @Override
+            public void postAddLockRecord(String resource, String owner) {
+                if(!Owner.A.name().equals(owner)) {
+                    synchronized(this) {
+                        notifyAll();
+                        wait = false;
+                    }
+                }
+            }
 
-			@Override
-			public void preUpdateLockRecord(String resource, String owner) {
-				preAddLockRecord(resource, owner);
-			}
+            @Override
+            public void preUpdateLockRecord(String resource, String owner) {
+                preAddLockRecord(resource, owner);
+            }
 
-			@Override
-			public void postUpdateLockRecord(String resource, String owner) {
-				postAddLockRecord(resource, owner);
-			}
-		};
-		if(!setSynchronizer(synchronizer)) {
-			return;
-		}
-		ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
-		// acquireLock by owner A should fail as it will wait for acquireLock by owner B
-		Future<Boolean> future1 = executor.submit(new Callable<Boolean>() {
-			@Override
-			public Boolean call() throws Exception {
-				try {
-					lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-					return false;
-				} catch(LockException e) {
-					// this call should fail as Synchronizer delays its lock to make sure the second call locks the resource first
-					Assert.assertEquals("Cannot lock resource [" + Resource.Resource1.name() + "] for [" + Owner.A.name() + "]: already locked by [" + Owner.B.name() + "]", e.getMessage());
-					return true;
-				}
-			}
-		});
-		try {
-			// acquireLock by owner B should success
-			Future<Boolean> future2 = executor.submit(new Callable<Boolean>() {
-				@Override
-				public Boolean call() throws Exception {
-					// this call should success as Synchronizer delays the above lock to make sure this call success to lock the resource
-					return lockManager.acquireLock(Resource.Resource1.name(), Owner.B.name());
-				}
-			});
-			try {
-				Assert.assertTrue(future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS));
-				Assert.assertTrue(future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS));
-			} finally {
-				future2.cancel(true);
-			}
-		} finally {
-			future1.cancel(true);
-		}
-	}
+            @Override
+            public void postUpdateLockRecord(String resource, String owner) {
+                postAddLockRecord(resource, owner);
+            }
+        };
+        if(!setSynchronizer(synchronizer)) {
+            return;
+        }
+        ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
+        // acquireLock by owner A should fail as it will wait for acquireLock by owner B
+        Future<Boolean> future1 = executor.submit(new Callable<Boolean>() {
+            @Override
+            public Boolean call() throws Exception {
+                try {
+                    lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+                    return false;
+                } catch(LockException e) {
+                    // this call should fail as Synchronizer delays its lock to make sure the second call locks the resource first
+                    Assert.assertEquals("VNF : [" + Resource.Resource1.name() + "] is locked by request id : [" + Owner.B.name() + "]", e.getMessage());
+                    return true;
+                }
+            }
+        });
+        try {
+            // acquireLock by owner B should success
+            Future<Boolean> future2 = executor.submit(new Callable<Boolean>() {
+                @Override
+                public Boolean call() throws Exception {
+                    // this call should success as Synchronizer delays the above lock to make sure this call success to lock the resource
+                    return lockManager.acquireLock(Resource.Resource1.name(), Owner.B.name());
+                }
+            });
+            try {
+                Assert.assertTrue(future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS));
+                Assert.assertTrue(future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS));
+            } finally {
+                future2.cancel(true);
+            }
+        } finally {
+            future1.cancel(true);
+        }
+    }
 
-	@Test
-	public void testConcurrentLockSameOwner() throws LockException, InterruptedException, ExecutionException, TimeoutException {
-		final int participantsNo = 2;
-		Synchronizer synchronizer = new Synchronizer(participantsNo) {
+    @Test
+    public void testConcurrentLockSameOwner() throws LockException, InterruptedException, ExecutionException, TimeoutException {
+        final int participantsNo = 2;
+        Synchronizer synchronizer = new Synchronizer(participantsNo) {
 
-			private boolean wait = true;
+            private boolean wait = true;
 
-			@Override
-			public void preAddLockRecord(String resource, String owner) {
-				synchronized(this) {
-					if(wait) {
-						wait = false;
-						waitOn(this);
-					}
-				}
-			}
+            @Override
+            public void preAddLockRecord(String resource, String owner) {
+                synchronized(this) {
+                    if(wait) {
+                        wait = false;
+                        waitOn(this);
+                    }
+                }
+            }
 
-			@Override
-			public void postAddLockRecord(String resource, String owner) {
-				synchronized(this) {
-					notifyAll();
-				}
-			}
-		};
-		if(!setSynchronizer(synchronizer)) {
-			return;
-		}
-		ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
-		// one acquireLock should return true and the other should return false
-		Callable<Boolean> callable = new Callable<Boolean>() {
-			@Override
-			public Boolean call() throws Exception {
-				return lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-			}
-		};
-		Future<Boolean> future1 = executor.submit(callable);
-		try {
-			Future<Boolean> future2 = executor.submit(callable);
-			try {
-				boolean future1Res = future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
-				boolean future2Res = future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
-				// one of the lock requests should return true, the other one false as lock is requested simultaneously from 2 threads by same owner
-				Assert.assertNotEquals(future1Res, future2Res);
-			} finally {
-				future2.cancel(true);
-			}
-		} finally {
-			future1.cancel(true);
-		}
-	}
+            @Override
+            public void postAddLockRecord(String resource, String owner) {
+                synchronized(this) {
+                    notifyAll();
+                }
+            }
+        };
+        if(!setSynchronizer(synchronizer)) {
+            return;
+        }
+        ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
+        // one acquireLock should return true and the other should return false
+        Callable<Boolean> callable = new Callable<Boolean>() {
+            @Override
+            public Boolean call() throws Exception {
+                return lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+            }
+        };
+        Future<Boolean> future1 = executor.submit(callable);
+        try {
+            Future<Boolean> future2 = executor.submit(callable);
+            try {
+                boolean future1Res = future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
+                boolean future2Res = future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
+                // one of the lock requests should return true, the other one false as lock is requested simultaneously from 2 threads by same owner
+                Assert.assertNotEquals(future1Res, future2Res);
+            } finally {
+                future2.cancel(true);
+            }
+        } finally {
+            future1.cancel(true);
+        }
+    }
 
-	@Test
-	public void testConcurrentUnlockSameOwner() throws LockException, InterruptedException, ExecutionException, TimeoutException {
-		lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
-		final int participantsNo = 2;
-		Synchronizer synchronizer = new Synchronizer(participantsNo) {
+    @Test
+    public void testConcurrentUnlockSameOwner() throws LockException, InterruptedException, ExecutionException, TimeoutException {
+        lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
+        final int participantsNo = 2;
+        Synchronizer synchronizer = new Synchronizer(participantsNo) {
 
-			private boolean wait = true;
+            private boolean wait = true;
 
-			@Override
-			public void preUpdateLockRecord(String resource, String owner) {
-				synchronized(this) {
-					// make sure second call updates the LockRecord first
-					if(wait) {
-						wait = false;
-						waitOn(this);
-					}
-				}
-			}
+            @Override
+            public void preUpdateLockRecord(String resource, String owner) {
+                synchronized(this) {
+                    // make sure second call updates the LockRecord first
+                    if(wait) {
+                        wait = false;
+                        waitOn(this);
+                    }
+                }
+            }
 
-			@Override
-			public void postUpdateLockRecord(String resource, String owner) {
-				synchronized(this) {
-					notifyAll();
-				}
-			}
-		};
-		if(!setSynchronizer(synchronizer)) {
-			return;
-		}
-		ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
-		Callable<Boolean> callable = new Callable<Boolean>() {
-			@Override
-			public Boolean call() throws Exception {
-				try {
-					lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-					// one of the unlock calls should success
-					return true;
-				} catch(LockException e) {
-					// one of the unlock calls should throw the LockException as the resource should already be unlocked by other call
-					Assert.assertEquals("Error unlocking resource [" + Resource.Resource1.name() + "]: resource is not locked", e.getMessage());
-					return false;
-				}
-			}
-		};
-		Future<Boolean> future1 = executor.submit(callable);
-		try {
-			Future<Boolean> future2 = executor.submit(callable);
-			try {
-				boolean future1Res = future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
-				boolean future2Res = future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
-				// one of the unlock calls should return true, the other one false as unlock is requested simultaneously from 2 threads by same owner
-				Assert.assertNotEquals(future1Res, future2Res);
-			} finally {
-				future2.cancel(true);
-			}
-		} finally {
-			future1.cancel(true);
-		}
-	}
+            @Override
+            public void postUpdateLockRecord(String resource, String owner) {
+                synchronized(this) {
+                    notifyAll();
+                }
+            }
+        };
+        if(!setSynchronizer(synchronizer)) {
+            return;
+        }
+        ExecutorService executor = Executors.newFixedThreadPool(participantsNo);
+        Callable<Boolean> callable = new Callable<Boolean>() {
+            @Override
+            public Boolean call() throws Exception {
+                try {
+                    lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
+                    // one of the unlock calls should success
+                    return true;
+                } catch(LockException e) {
+                    // one of the unlock calls should throw the LockException as the resource should already be unlocked by other call
+                    Assert.assertEquals("Error unlocking resource [" + Resource.Resource1.name() + "]: resource is not locked", e.getMessage());
+                    return false;
+                }
+            }
+        };
+        Future<Boolean> future1 = executor.submit(callable);
+        try {
+            Future<Boolean> future2 = executor.submit(callable);
+            try {
+                boolean future1Res = future1.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
+                boolean future2Res = future2.get(CONCURRENT_TEST_WAIT_TIME, TimeUnit.SECONDS);
+                // one of the unlock calls should return true, the other one false as unlock is requested simultaneously from 2 threads by same owner
+                Assert.assertNotEquals(future1Res, future2Res);
+            } finally {
+                future2.cancel(true);
+            }
+        } finally {
+            future1.cancel(true);
+        }
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManagerMock.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManagerMock.java
index a4bbd34..51b1c31 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManagerMock.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/MySqlLockManagerMock.java
@@ -40,114 +40,114 @@
 
 class MySqlLockManagerMock extends MySqlLockManager implements SynchronizerReceiver {
 
-	private final Map<String, LockRecord> locks = new HashMap<>();
-	private final Lock lock = new ReentrantLock();
-	private boolean useReal;
-	private Synchronizer synchronizer;
+    private final Map<String, LockRecord> locks = new HashMap<>();
+    private final Lock lock = new ReentrantLock();
+    private boolean useReal;
+    private Synchronizer synchronizer;
 
-	MySqlLockManagerMock(boolean useReal) {
-		this.useReal = useReal;
-	}
+    MySqlLockManagerMock(boolean useReal) {
+        this.useReal = useReal;
+    }
 
-	@Override
-	public void setSynchronizer(Synchronizer synchronizer) {
-		this.synchronizer = synchronizer;
-	}
+    @Override
+    public void setSynchronizer(Synchronizer synchronizer) {
+        this.synchronizer = synchronizer;
+    }
 
-	@Override
-	protected Connection openDbConnection() {
-		if(useReal) {
-			return super.openDbConnection();
-		}
-		return null;
-	}
+    @Override
+    protected Connection openDbConnection() {
+        if(useReal) {
+            return super.openDbConnection();
+        }
+        return null;
+    }
 
-	@Override
-	protected void closeDbConnection(Connection connection) {
-		if(useReal) {
-			super.closeDbConnection(connection);
-		}
-	}
+    @Override
+    protected void closeDbConnection(Connection connection) {
+        if(useReal) {
+            super.closeDbConnection(connection);
+        }
+    }
 
-	@Override
-	protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
-		LockRecord res;
-		if(useReal) {
-			res = super.loadLockRecord(connection, resource);
-		} else {
-			res = locks.get(resource);
-		}
-		if(synchronizer != null) {
-			synchronizer.postLoadLockRecord(resource, (res == null) ? null : res.getOwner());
-		}
-		return res;
-	}
+    @Override
+    protected LockRecord loadLockRecord(Connection connection, String resource) throws SQLException {
+        LockRecord res;
+        if(useReal) {
+            res = super.loadLockRecord(connection, resource);
+        } else {
+            res = locks.get(resource);
+        }
+        if(synchronizer != null) {
+            synchronizer.postLoadLockRecord(resource, (res == null) ? null : res.getOwner());
+        }
+        return res;
+    }
 
-	@Override
-	protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(synchronizer != null) {
-			synchronizer.preAddLockRecord(resource, owner);
-		}
-		try {
-			if(useReal) {
-				super.addLockRecord(connection, resource, owner, timeout);
-				return;
-			}
-			LockRecord lockRecord = new LockRecord(resource);
-			lockRecord.setOwner(owner);
-			lockRecord.setUpdated(System.currentTimeMillis());
-			lockRecord.setTimeout(timeout);
-			locks.put(resource, lockRecord);
-		} finally {
-			if(synchronizer != null) {
-				synchronizer.postAddLockRecord(resource, owner);
-			}
-		}
-	}
+    @Override
+    protected void addLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(synchronizer != null) {
+            synchronizer.preAddLockRecord(resource, owner);
+        }
+        try {
+            if(useReal) {
+                super.addLockRecord(connection, resource, owner, timeout);
+                return;
+            }
+            LockRecord lockRecord = new LockRecord(resource);
+            lockRecord.setOwner(owner);
+            lockRecord.setUpdated(System.currentTimeMillis());
+            lockRecord.setTimeout(timeout);
+            locks.put(resource, lockRecord);
+        } finally {
+            if(synchronizer != null) {
+                synchronizer.postAddLockRecord(resource, owner);
+            }
+        }
+    }
 
-	@Override
-	protected void updateLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
-		if(synchronizer != null) {
-			synchronizer.preUpdateLockRecord(resource, owner);
-		}
-		try {
-			if(useReal) {
-				super.updateLockRecord(connection, resource, owner, timeout);
-				return;
-			}
-			LockRecord lockRecord = loadLockRecord(connection, resource);
-			lockRecord.setOwner(owner);
-			lockRecord.setUpdated(System.currentTimeMillis());
-			lockRecord.setTimeout(timeout);
-			locks.put(resource, lockRecord);
-		} finally {
-			if(synchronizer != null) {
-				synchronizer.postUpdateLockRecord(resource, owner);
-			}
-		}
-	}
+    @Override
+    protected void updateLockRecord(Connection connection, String resource, String owner, long timeout) throws SQLException {
+        if(synchronizer != null) {
+            synchronizer.preUpdateLockRecord(resource, owner);
+        }
+        try {
+            if(useReal) {
+                super.updateLockRecord(connection, resource, owner, timeout);
+                return;
+            }
+            LockRecord lockRecord = loadLockRecord(connection, resource);
+            lockRecord.setOwner(owner);
+            lockRecord.setUpdated(System.currentTimeMillis());
+            lockRecord.setTimeout(timeout);
+            locks.put(resource, lockRecord);
+        } finally {
+            if(synchronizer != null) {
+                synchronizer.postUpdateLockRecord(resource, owner);
+            }
+        }
+    }
 
-	@Override
-	protected void enterCriticalSection(Connection connection, String resource) {
-		if(useReal) {
-			super.enterCriticalSection(connection, resource);
-			return;
-		}
-		try {
-			if(!lock.tryLock(criticalSectionWaitTimeoutSecs, TimeUnit.SECONDS)) {
+    @Override
+    protected void enterCriticalSection(Connection connection, String resource) {
+        if(useReal) {
+            super.enterCriticalSection(connection, resource);
+            return;
+        }
+        try {
+            if(!lock.tryLock(criticalSectionWaitTimeoutSecs, TimeUnit.SECONDS)) {
                 throw new LockRuntimeException("Cannot obtain critical section lock for resource [" + resource + "].");
-			}
-		} catch(InterruptedException e) {
-			throw new LockRuntimeException("Cannot obtain critical section lock.", e);
-		}
-	}
+            }
+        } catch(InterruptedException e) {
+            throw new LockRuntimeException("Cannot obtain critical section lock.", e);
+        }
+    }
 
-	@Override
-	protected void leaveCriticalSection(Connection connection, String resource) {
-		if(useReal) {
-			super.leaveCriticalSection(connection, resource);
-			return;
-		}
-		lock.unlock();
-	}
+    @Override
+    protected void leaveCriticalSection(Connection connection, String resource) {
+        if(useReal) {
+            super.leaveCriticalSection(connection, resource);
+            return;
+        }
+        lock.unlock();
+    }
 }
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/TestMySqlLockManager.java b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/TestMySqlLockManager.java
index c54cfc8..b13207d 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/TestMySqlLockManager.java
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/lock-manager-impl/src/test/java/org/onap/appc/lockmanager/impl/sql/pessimistic/TestMySqlLockManager.java
@@ -39,13 +39,13 @@
 
     private static int CRITICAL_SECTION_WAIT_TIMEOUT = 1; // in secs
 
-	@Override
-	protected JdbcLockManager createJdbcLockManager(boolean useReal) {
-		return new MySqlLockManagerMock(useReal);
-	}
+    @Override
+    protected JdbcLockManager createJdbcLockManager(boolean useReal) {
+        return new MySqlLockManagerMock(useReal);
+    }
 
-	@Test
-	public void testConcurrentLock() throws LockException, InterruptedException, ExecutionException, TimeoutException {
+    @Test
+    public void testConcurrentLock() throws LockException, InterruptedException, ExecutionException, TimeoutException {
         try {
             callConcurrentTest(new Callable<Boolean>() {
                 @Override
@@ -61,10 +61,10 @@
             });
         } finally {
             lockManager.releaseLock(Resource.Resource1.name(), Owner.A.name());
-		}
-	}
+        }
+    }
 
-	@Test
+    @Test
     public void testConcurrentUnlock() throws LockException, InterruptedException, ExecutionException, TimeoutException {
         lockManager.acquireLock(Resource.Resource1.name(), Owner.A.name());
         callConcurrentTest(new Callable<Boolean>() {
diff --git a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/pom.xml b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/pom.xml
index 7c6ae99..b9d259b 100644
--- a/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/pom.xml
+++ b/appc-dispatcher/appc-dispatcher-common/lock-manager-lib/pom.xml
@@ -1,5 +1,30 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  ================================================================================
+  Copyright (C) 2017 Amdocs
+  =============================================================================
+  Licensed 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.
+
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  ============LICENSE_END=========================================================
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>appc-dispatcher-common</artifactId>
@@ -7,11 +32,13 @@
         <version>1.3.0-SNAPSHOT</version>
     </parent>
     <artifactId>lock-manager-lib</artifactId>
+    <name>APPC Lock Manager Lib</name>
     <packaging>pom</packaging>
 
+
     <modules>
         <module>lock-manager-api</module>
         <module>lock-manager-impl</module>
         <module>lock-manager-features</module>
     </modules>
-</project>
\ No newline at end of file
+</project>
