changeset 691:ca33c41c9f69

Locking disabled on windows machines
author Jiri Vanek <jvanek@redhat.com>
date Thu, 25 Apr 2013 14:25:45 +0200
parents c5db48847b93
children 1da533f89607
files ChangeLog netx/net/sourceforge/jnlp/util/lockingfile/LockedFile.java
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 25 14:20:19 2013 +0200
+++ b/ChangeLog	Thu Apr 25 14:25:45 2013 +0200
@@ -1,4 +1,10 @@
-2013-04-19  Jiri Vanek <jvanek@redhat.com>
+2013-04-25  Jiri Vanek <jvanek@redhat.com>	
+
+	Locking disabled on windows machines
+	* netx/net/sourceforge/jnlp/util/lockingfile/LockedFile.java:
+	(lock) and (unlock) are no-op on windows.
+
+2013-04-25  Jiri Vanek <jvanek@redhat.com>
 
 	Splashscreen now strip commit id from released versions
 	*  netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java:
@@ -6,8 +12,7 @@
 	(drawBase) now using stripCommitFromVersion before printing drawing version
 	to splashscreen
 	* tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainterTest.java:
-	(stripCommitFromVersion) new test for 
-	
+	(stripCommitFromVersion) new test for 	
 
 2013-04-24  Adam Domurad  <adomurad@redhat.com>
 
--- a/netx/net/sourceforge/jnlp/util/lockingfile/LockedFile.java	Thu Apr 25 14:20:19 2013 +0200
+++ b/netx/net/sourceforge/jnlp/util/lockingfile/LockedFile.java	Thu Apr 25 14:25:45 2013 +0200
@@ -44,6 +44,7 @@
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.concurrent.locks.ReentrantLock;
+import net.sourceforge.jnlp.runtime.JNLPRuntime;
 
 /*
  * Process & thread locked access to a file. Creates file if it does not already exist.
@@ -112,6 +113,9 @@
      * Lock access to the file. Lock is reentrant.
      */
     public void lock() throws IOException {
+        if (JNLPRuntime.isWindows()) {
+            return;
+        }
         // Create if does not already exist, cannot lock non-existing file
         if (!isReadOnly()) {
             this.file.createNewFile();
@@ -136,6 +140,9 @@
      * Unlock access to the file. Lock is reentrant.
      */
     public void unlock() throws IOException {
+        if (JNLPRuntime.isWindows()) {
+            return;
+        }
         boolean releaseProcessLock = (this.threadLock.getHoldCount() == 1);
         try {
             if (releaseProcessLock) {