more locked IO performance tests.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 20 Jan 2006 08:50:30 +0000 (08:50 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 20 Jan 2006 08:50:30 +0000 (08:50 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@151 be28352e-c001-0410-b1a7-c7978e42abec

src/org/vamsas/client/simpleclient/VamsasArchive.java
src/org/vamsas/client/simpleclient/VamsasFile.java
src/org/vamsas/test/simpleclient/ArchiveReports.java
src/org/vamsas/test/simpleclient/ArchiveWatcher.java

index f55d3d8..ea11a81 100644 (file)
@@ -263,10 +263,8 @@ public class VamsasArchive {
     
     if (rchive==null)
       rchive = new SessionFile(archive);
-    archive.createNewFile();
     if (!rchive.lockFile()) 
       throw new IOException("Failed to get lock on file "+archive);
-  
     newarchive = new JarOutputStream(new BufferedOutputStream(new java.io.FileOutputStream(archive)));  
     entries = new Hashtable();
   }
index 4199dd2..dbff158 100644 (file)
@@ -68,7 +68,9 @@ public class VamsasFile extends SessionFile {
       ;
     return fileLock;
   }
-  
+  public void unLock() {
+    this.unlockFile();
+  }
   public java.io.Reader getDocumentReader() {
     
     try {
index b38f87a..c970552 100644 (file)
@@ -107,7 +107,7 @@ public class ArchiveReports {
       }
       return true;
     } else {
-      outstr.print("Document Object is null");
+      outstr.println("Document Object is null");
     }
     return false;
   }
index 23396a6..8340413 100644 (file)
@@ -26,7 +26,7 @@ public class ArchiveWatcher {
           archive.createNewFile();
  */       // watch the new file... - taken straight from ClientsFileTest
         FileWatcher w = new FileWatcher(archive);
-        while (archive.exists()) {
+        while (true) {
           
           // get watcher's lock to ensure state change is fixed for retrieval
           Lock chlock = w.getChangedState();