Author: rvesse
Date: Tue Jul 22 10:30:35 2014
New Revision: 1612533

URL: http://svn.apache.org/r1612533
Log:
Make LocationLock error messages more detailed in a couple of cases (JENA-648)

Modified:
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java
    
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/LocationLock.java

Modified: 
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java?rev=1612533&r1=1612532&r2=1612533&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java 
(original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/StoreConnection.java 
Tue Jul 22 10:30:35 2014
@@ -252,14 +252,14 @@ public class StoreConnection
                 LocationLock lock = location.getLock();
                 if (lock.canLock()) {
                     if (!lock.canObtain()) 
-                        throw new TDBException("Can't open database at 
location " + location.getDirectoryPath() + " as it is already locked by the 
process with PID " + lock.getOwner());
+                        throw new TDBException("Can't open database at 
location " + location.getDirectoryPath() + " as it is already locked by the 
process with PID " + lock.getOwner() + ".  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");
 
                     lock.obtain();
                     // There's an interesting race condition here that two 
JVMs might write out the lock file one after another without
                     // colliding and causing an IO error in either.  The best 
way to check for this is simply to check we now own the lock
                     // and if not error
                     if (!lock.isOwned()) {
-                        throw new TDBException("Can't open database at 
location " + location.getDirectoryPath() + " as it is alread locked by the 
process with PID " + lock.getOwner());
+                        throw new TDBException("Can't open database at 
location " + location.getDirectoryPath() + " as it is alread locked by the 
process with PID " + lock.getOwner() + ".  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");
                     }
                 }
             }

Modified: 
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/LocationLock.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/LocationLock.java?rev=1612533&r1=1612532&r2=1612533&view=diff
==============================================================================
--- 
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/LocationLock.java
 (original)
+++ 
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/file/LocationLock.java
 Tue Jul 22 10:30:35 2014
@@ -174,11 +174,11 @@ public class LocationLock {
             // Check if the owner is alive
             if (ProcessUtils.isAlive(owner))
                 throw new TDBException(
-                        "The location "
+                        "Location "
                                 + location.getDirectoryPath()
                                 + " is currently locked by PID "
                                 + owner
-                                + ".  TDB databases do not permit concurrent 
usage across JVMs so in order to prevent corruption you cannot open this 
location from the JVM that does not own the lock for the dataset");
+                                + ".  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));


Reply via email to