You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/05/13 13:51:31 UTC

[2/4] jena git commit: Include own process id.

Include own process id.

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

Branch: refs/heads/master
Commit: b6d9ffad13f8983edca877e761a77885d728536c
Parents: d913101
Author: Andy Seaborne <an...@apache.org>
Authored: Fri May 13 12:40:12 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri May 13 12:40:12 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/jena/tdb/base/file/LocationLock.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/b6d9ffad/jena-tdb/src/main/java/org/apache/jena/tdb/base/file/LocationLock.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/base/file/LocationLock.java b/jena-tdb/src/main/java/org/apache/jena/tdb/base/file/LocationLock.java
index 3a28efb..aabc5b6 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/base/file/LocationLock.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/base/file/LocationLock.java
@@ -157,9 +157,9 @@ public class LocationLock {
 
         // Get current owner
         int owner = this.getOwner();
+        int pid = ProcessUtils.getPid(NO_OWNER);
         if (owner == NO_OWNER) {
             // No owner currently so try to obtain the lock
-            int pid = ProcessUtils.getPid(NO_OWNER);
             if (pid == NO_OWNER) {
                 // In the case where we cannot obtain our PID then we cannot
                 // obtain a lock
@@ -174,10 +174,11 @@ public class LocationLock {
         } else {
             // Someone other process potentially owns the lock on this location
             // Check if the owner is alive
-            if (ProcessUtils.isAlive(owner))
+            if (ProcessUtils.isAlive(owner)) {
                 throw new TDBException("Location " + location.getDirectoryPath() + " is currently locked by PID "
-                        + owner
+                        + owner + "(this process is PID "+pid+")"
                         + ".  TDB databases do not permit concurrent usage across JVMs so in order to prevent possible data corruption you cannot open this location from the JVM that does not own the lock for the dataset");
+            }
 
             // Otherwise the previous owner is dead so we can take the lock
             takeLock(ProcessUtils.getPid(NO_OWNER));