Author: clebert.suconic(a)jboss.com
Date: 2011-12-05 16:17:25 -0500 (Mon, 05 Dec 2011)
New Revision: 11841
Modified:
branches/Branch_2_2_EAP/.classpath
branches/Branch_2_2_EAP/docs/user-manual/en/clusters.xml
branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java
Log:
Adding doc for JBPAPP-7455
Modified: branches/Branch_2_2_EAP/.classpath
===================================================================
--- branches/Branch_2_2_EAP/.classpath 2011-12-05 21:16:57 UTC (rev 11840)
+++ branches/Branch_2_2_EAP/.classpath 2011-12-05 21:17:25 UTC (rev 11841)
@@ -113,7 +113,7 @@
<classpathentry kind="lib"
path="thirdparty/org/jboss/integration/lib/jboss-transaction-spi.jar"/>
<classpathentry kind="lib"
path="thirdparty/org/jboss/javaee/lib/jboss-jaspi-api.jar"/>
<classpathentry kind="lib"
path="thirdparty/org/jboss/javaee/lib/jboss-jca-api.jar"/>
- <classpathentry kind="lib"
path="thirdparty/org/jboss/javaee/lib/jboss-jms-api.jar"/>
+ <classpathentry kind="lib"
path="thirdparty/org/jboss/javaee/lib/jboss-jms-api.jar"
sourcepath="/Users/clebertsuconic/.m2/repository/org/jboss/javaee/jboss-jms-api/1.1.0.GA/jboss-jms-api-1.1.0.GA-sources.jar"/>
<classpathentry kind="lib"
path="thirdparty/org/jboss/javaee/lib/jboss-transaction-api.jar"/>
<classpathentry kind="lib"
path="thirdparty/org/jboss/lib/jboss-common-core.jar"/>
<classpathentry kind="lib"
path="thirdparty/org/jboss/lib/jboss-mdr.jar"/>
Modified: branches/Branch_2_2_EAP/docs/user-manual/en/clusters.xml
===================================================================
--- branches/Branch_2_2_EAP/docs/user-manual/en/clusters.xml 2011-12-05 21:16:57 UTC (rev
11840)
+++ branches/Branch_2_2_EAP/docs/user-manual/en/clusters.xml 2011-12-05 21:17:25 UTC (rev
11841)
@@ -511,6 +511,16 @@
false</literal>.</para>
</listitem>
<listitem>
+ <para><literal>min-large-message-size</literal>.
This parameters determines when a
+ message should be splitted with multiple packages when
sent over the cluster.</para>
+ <para>This parameter is optional and its default is at
100K.</para>
+ </listitem>
+ <listitem>
+
<para><literal>reconnect-attempts"</literal>.The number of times
the system will
+ try to connect a node on the cluster. If the max-retry is
achieved this node will be considered permanently down and the system will stop routing
messages to this node.</para>
+ <para>This parameter is optional and its default is at -1
(infinite retries).</para>
+ </listitem>
+ <listitem>
<para><literal>max-hops</literal>. When a cluster
connection decides the set of
nodes to which it might load balance a message, those nodes do
not have to
be directly connected to it via a cluster connection. HornetQ can
be
Modified: branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java
===================================================================
--- branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java 2011-12-05
21:16:57 UTC (rev 11840)
+++ branches/Branch_2_2_EAP/src/main/org/hornetq/core/paging/impl/PageImpl.java 2011-12-05
21:17:25 UTC (rev 11841)
@@ -13,6 +13,7 @@
package org.hornetq.core.paging.impl;
+import java.lang.ref.WeakReference;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
@@ -115,9 +116,9 @@
ArrayList<PagedMessage> messages = new ArrayList<PagedMessage>();
size.set((int)file.size());
- // Using direct buffer, as described on
https://jira.jboss.org/browse/HORNETQ-467
- ByteBuffer buffer2 = ByteBuffer.allocateDirect(size.get());
+ ByteBuffer buffer2 = allocateBuffer();
+
file.position(0);
file.read(buffer2);
@@ -175,6 +176,38 @@
return messages;
}
+ /**
+ * @return
+ * @throws InterruptedException
+ */
+ private ByteBuffer allocateBuffer() throws InterruptedException
+ {
+ // Using direct buffer, as described on
https://jira.jboss.org/browse/HORNETQ-467
+ ByteBuffer buffer2 = null;
+ try
+ {
+ buffer2 = ByteBuffer.allocateDirect(size.get());
+ }
+ catch (OutOfMemoryError error)
+ {
+ // This is a workaround for the way the JDK will deal with native buffers.
+ // the main portion is outside of the VM heap
+ // and the JDK will not have any reference about it to take GC into account
+ // so we force a GC and try again.
+ WeakReference<Object> obj = new WeakReference<Object>(new
Object());
+ long timeout = System.currentTimeMillis() + 5000;
+ while (System.currentTimeMillis() > timeout && obj.get() != null)
+ {
+ System.gc();
+ Thread.sleep(100);
+ }
+
+ buffer2 = ByteBuffer.allocateDirect(size.get());
+
+ }
+ return buffer2;
+ }
+
public void write(final PagedMessage message) throws Exception
{
ByteBuffer buffer = fileFactory.newBuffer(message.getEncodeSize() +
PageImpl.SIZE_RECORD);