[jboss-cvs] JBoss Messaging SVN: r7444 - in branches/clebert_temp_expirement: src/main/org/jboss/messaging/core/journal and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 23 15:01:14 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-23 15:01:14 -0400 (Tue, 23 Jun 2009)
New Revision: 7444

Modified:
   branches/clebert_temp_expirement/native/bin/libJBMLibAIO32.so
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/SequentialFile.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
Log:
just a few experiments

Modified: branches/clebert_temp_expirement/native/bin/libJBMLibAIO32.so
===================================================================
(Binary files differ)

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/SequentialFile.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/SequentialFile.java	2009-06-23 16:46:34 UTC (rev 7443)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/SequentialFile.java	2009-06-23 19:01:14 UTC (rev 7444)
@@ -79,6 +79,8 @@
    long position() throws Exception;
 
    void close() throws Exception;
+   
+   void waitForClose() throws Exception;
 
    void sync() throws Exception;
 

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java	2009-06-23 16:46:34 UTC (rev 7443)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/AIOSequentialFile.java	2009-06-23 19:01:14 UTC (rev 7444)
@@ -172,8 +172,22 @@
 
       aioFile.close();
       aioFile = null;
+      
+      this.notifyAll();
    }
 
+   /* (non-Javadoc)
+    * @see org.jboss.messaging.core.journal.SequentialFile#waitForClose()
+    */
+   public synchronized void waitForClose() throws Exception
+   {
+      if (isOpen())
+      {
+         wait();
+      }
+   }
+
+
    public void delete() throws Exception
    {
       if (aioFile != null)
@@ -518,5 +532,4 @@
       }
 
    }
-
 }

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-23 16:46:34 UTC (rev 7443)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-23 19:01:14 UTC (rev 7444)
@@ -2529,6 +2529,7 @@
    // You need to guarantee lock.acquire() before calling this method
    private void moveNextFile() throws InterruptedException
    {
+      // Asynchronously close the file
       closeFile(currentFile);
 
       currentFile = enqueueOpenFile();

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java	2009-06-23 16:46:34 UTC (rev 7443)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/NIOSequentialFile.java	2009-06-23 19:01:14 UTC (rev 7444)
@@ -127,8 +127,16 @@
       
       fileSize = channel.size();
    }
+   
+   public synchronized void waitForClose() throws Exception
+   {
+      if (isOpen())
+      {
+         wait();
+      }
+   }
 
-   public void close() throws Exception
+   public synchronized void close() throws Exception
    {
       if (channel != null)
       {
@@ -143,6 +151,8 @@
       channel = null;
 
       rfile = null;
+      
+      notifyAll();
    }
 
    public void delete() throws Exception
@@ -234,7 +244,10 @@
 
    public void sync() throws Exception
    {
-      channel.force(false);
+      if (channel != null)
+      {
+         channel.force(false);
+      }
    }
 
    public long size() throws Exception

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java	2009-06-23 16:46:34 UTC (rev 7443)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java	2009-06-23 19:01:14 UTC (rev 7444)
@@ -332,7 +332,7 @@
          this.fileName = fileName;
       }
 
-      public void close() throws Exception
+      public synchronized void close() throws Exception
       {
          open = false;
 
@@ -340,8 +340,20 @@
          {
             data.position(0);
          }
+         
+         this.notifyAll();
       }
+      
+      public synchronized void waitForClose() throws Exception
+      {
+         if (!open)
+         {
+            this.wait();
+         }
+      }
 
+
+
       public void delete() throws Exception
       {
          if (!open)




More information about the jboss-cvs-commits mailing list