[hornetq-commits] JBoss hornetq SVN: r11899 - in branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710: src/main/org/hornetq/core/journal/impl and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Dec 12 17:03:12 EST 2011


Author: clebert.suconic at jboss.com
Date: 2011-12-12 17:03:12 -0500 (Mon, 12 Dec 2011)
New Revision: 11899

Modified:
   branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/SequentialFileFactory.java
   branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/AIOSequentialFileFactory.java
   branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/NIOSequentialFileFactory.java
   branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
   branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
Log:
JBPAPP-7655 - The customer is facing an issue that's directly related to the way concurrent paging will happen, and multiple pages being accessed. We are adding a direct allocation on Paging (and releasing it manually what is causing issues with NIO), and we are also dealing with some max-IO on paging.. Adding this to JBPAPP-7710

Modified: branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/SequentialFileFactory.java
===================================================================
--- branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/SequentialFileFactory.java	2011-12-12 21:36:13 UTC (rev 11898)
+++ branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/SequentialFileFactory.java	2011-12-12 22:03:12 UTC (rev 11899)
@@ -32,6 +32,14 @@
 
    boolean isSupportsCallbacks();
 
+   /** used for cases where you need direct buffer outside of the journal context.
+    *  This is because the native layer has a method that can be reused in certain cases like paging */
+   ByteBuffer allocateDirectBuffer(int size);
+   
+   /** used for cases where you need direct buffer outside of the journal context.
+    *  This is because the native layer has a method that can be reused in certain cases like paging */
+   void releaseDirectBuffer(ByteBuffer buffer);
+
    /**
     * Note: You need to release the buffer if is used for reading operations.
     *       You don't need to do it if using writing operations (AIO Buffer Lister will take of writing operations)

Modified: branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/AIOSequentialFileFactory.java
===================================================================
--- branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/AIOSequentialFileFactory.java	2011-12-12 21:36:13 UTC (rev 11898)
+++ branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/AIOSequentialFileFactory.java	2011-12-12 22:03:12 UTC (rev 11899)
@@ -93,7 +93,29 @@
    {
       return AsynchronousFileImpl.isLoaded();
    }
+   
+   public ByteBuffer allocateDirectBuffer(final int size)
+   {
+      
+      int blocks = size / 512;
+      if (size % 512 != 0)
+      {
+         blocks ++;
+      }
+      
+      // The buffer on AIO has to be a multiple of 512
+      ByteBuffer buffer = AsynchronousFileImpl.newBuffer(blocks * 512);
+      
+      buffer.limit(size);
 
+      return buffer;
+   }
+   
+   public void releaseDirectBuffer(final ByteBuffer buffer)
+   {
+      AsynchronousFileImpl.destroyBuffer(buffer);
+   }
+
    public ByteBuffer newBuffer(int size)
    {
       if (size % 512 != 0)

Modified: branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/NIOSequentialFileFactory.java
===================================================================
--- branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/NIOSequentialFileFactory.java	2011-12-12 21:36:13 UTC (rev 11898)
+++ branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/journal/impl/NIOSequentialFileFactory.java	2011-12-12 22:03:12 UTC (rev 11899)
@@ -74,6 +74,17 @@
    {
       return timedBuffer != null;
    }
+   
+   
+   public ByteBuffer allocateDirectBuffer(final int size)
+   {
+      return ByteBuffer.allocateDirect(size);
+   }
+   
+   public void releaseDirectBuffer(ByteBuffer buffer)
+   {
+      // nothing we can do on this case. we can just have good faith on GC
+   }
 
    public ByteBuffer newBuffer(final int size)
    {

Modified: branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2011-12-12 21:36:13 UTC (rev 11898)
+++ branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java	2011-12-12 22:03:12 UTC (rev 11899)
@@ -1556,7 +1556,7 @@
     */
    public ByteBuffer allocateDirectBuffer(int size)
    {
-      return journalFF.newBuffer(size);
+      return journalFF.allocateDirectBuffer(size);
    }
 
    /* (non-Javadoc)

Modified: branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java
===================================================================
--- branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java	2011-12-12 21:36:13 UTC (rev 11898)
+++ branches/one-offs/HornetQ_2_2_5_EAP_GA_JBPAPP_7710/tests/src/org/hornetq/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java	2011-12-12 22:03:12 UTC (rev 11899)
@@ -757,4 +757,19 @@
    {
    }
 
+   /* (non-Javadoc)
+    * @see org.hornetq.core.journal.SequentialFileFactory#newDirectBuffer(int)
+    */
+   public ByteBuffer allocateDirectBuffer(int size)
+   {
+      return ByteBuffer.allocateDirect(size);
+   }
+
+   /* (non-Javadoc)
+    * @see org.hornetq.core.journal.SequentialFileFactory#releaseDirectBuffer(java.nio.ByteBuffer)
+    */
+   public void releaseDirectBuffer(ByteBuffer buffer)
+   {
+   }
+
 }



More information about the hornetq-commits mailing list