slackened lock_release success requirement.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 20 Oct 2005 09:58:13 +0000 (09:58 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 20 Oct 2005 09:58:13 +0000 (09:58 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@67 be28352e-c001-0410-b1a7-c7978e42abec

src/org/vamsas/client/simpleclient/ClientsFile.java
src/org/vamsas/test/simpleclient/ClientsFileTest.java

index aa62482..2a103ed 100644 (file)
@@ -68,22 +68,15 @@ public class ClientsFile {
    * 
    * @return true if lock was released.
    */
-  protected boolean unlockList() {
+  protected void unlockList() {
     if (listlock != null) {
 
       if (listlock.isLocked()) {
-        try {
-          listlock.lock.release();
-        } catch (IOException e) {
-          // TODO Deal with unlock Lock.release exception!
-          e.printStackTrace(System.err);
-        }
+        listlock.release();
       }
 
       listlock = null;
-      return true;
     }
-    return false;
   }
 
   /**
@@ -127,8 +120,8 @@ public class ClientsFile {
   public ClientHandle[] retrieveClientList() {
     if (lockList()) {
       ClientHandle[] clients = retrieveClientHandles();
-      if (unlockList())
-        return clients;
+      unlockList();
+      return clients;
     }
     return null;
   }
index f484a63..58dcbec 100644 (file)
@@ -92,10 +92,10 @@ public class ClientsFileTest {
             FileWatcher w=new FileWatcher(cf);
             while (cf.exists()) {
               if (w.hasChanged()) {
+                ClientHandle[] cl = cfhand.retrieveClientList();
                 System.out.println("-- Watching "+cf.getName());
                 //while (w.hasChanged())
                 //  ;
-                ClientHandle[] cl = cfhand.retrieveClientList();
                 if (cl!=null) {
                   for (int chi=0,che=cl.length; chi<che; chi++) {
                     System.out.println("Client "+chi+" ("+cl[chi].getClientName()+" "+cl[chi].getVersion()+" "+cl[chi].getClientUrn()+")");
@@ -114,6 +114,8 @@ public class ClientsFileTest {
       if (coms!=null) {
         System.err.println("Unknown command : "+args[argc++] + "*Ignored!*");
       };
+      for (int j=0; j<900000; j++)
+        ;
     }
   }