JBoss Remoting SVN: r4433 - remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-07-28 17:11:10 -0400 (Mon, 28 Jul 2008)
New Revision: 4433
Modified:
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java
Log:
Add iterator/iterable combining methods.
Modified: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java 2008-07-26 20:09:43 UTC (rev 4432)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java 2008-07-28 21:11:10 UTC (rev 4433)
@@ -451,6 +451,14 @@
return unroll(iterator, type, 0);
}
+ /**
+ * Convert an iterator to an array in reverse order. The iterator should be relatively short to avoid blowing out the
+ * stack.
+ *
+ * @param iterator the iterator
+ * @param type the array element type
+ * @return the array
+ */
public static <T> T[] toArrayReversed(final Iterator<? extends T> iterator, final Class<T> type) {
return unrollReversed(iterator, type, 0);
}
@@ -648,4 +656,117 @@
original.previous();
}
}
+
+ /**
+ * Combine two {@code Iterator}s into one.
+ *
+ * @param first the first {@code Iterator}
+ * @param second the second {@code Iterator}
+ * @return a combined {@code Iterator}
+ */
+ public static <T> Iterator<T> combine(final Iterator<? extends T> first, final Iterator<? extends T> second) {
+ if (first == null) {
+ throw new NullPointerException("first is null");
+ }
+ if (second == null) {
+ throw new NullPointerException("second is null");
+ }
+ return new Iterator<T>() {
+ private Iterator<? extends T> current = first;
+ private Iterator<? extends T> next = second;
+
+ public boolean hasNext() {
+ if (current == null) {
+ return false;
+ }
+ if (! current.hasNext()) {
+ current = next;
+ next = null;
+ }
+ return current != null && current.hasNext();
+ }
+
+ public T next() {
+ if (current == null) {
+ throw new NoSuchElementException("next() past end of iterator");
+ }
+ return current.next();
+ }
+
+ public void remove() {
+ current.remove();
+ }
+ };
+ }
+
+ /**
+ * Combine three {@code Iterator}s into one.
+ *
+ * @param first the first {@code Iterator}
+ * @param second the second {@code Iterator}
+ * @param third the third {@code Iterator}
+ * @return a new combined {@code Iterator}
+ */
+ public static <T> Iterator<T> combine(final Iterator<? extends T> first, final Iterator<? extends T> second, final Iterator<? extends T> third) {
+ return combine(combine(first, second), third);
+ }
+
+ /**
+ * Combine four {@code Iterator}s into one.
+ *
+ * @param first the first {@code Iterator}
+ * @param second the second {@code Iterator}
+ * @param third the third {@code Iterator}
+ * @param fourth the fourth {@code Iterator}
+ * @return a new combined {@code Iterator}
+ */
+ public static <T> Iterator<T> combine(final Iterator<? extends T> first, final Iterator<? extends T> second, final Iterator<? extends T> third, final Iterator<? extends T> fourth) {
+ return combine(combine(first, second), combine(third, fourth));
+ }
+
+ /**
+ * Combine two {@code Iterable}s into one.
+ *
+ * @param first the first {@code Iterable}
+ * @param second the second {@code Iterable}
+ * @return a new combined {@code Iterable}
+ */
+ public static <T> Iterable<T> combine(final Iterable<? extends T> first, final Iterable<? extends T> second) {
+ if (first == null) {
+ throw new NullPointerException("first is null");
+ }
+ if (second == null) {
+ throw new NullPointerException("second is null");
+ }
+ return new Iterable<T>() {
+ public Iterator<T> iterator() {
+ return combine(first.iterator(), second.iterator());
+ }
+ };
+ }
+
+ /**
+ * Combine three {@code Iterable}s into one.
+ *
+ * @param first the first {@code Iterable}
+ * @param second the second {@code Iterable}
+ * @param third the third {@code Iterable}
+ * @return a new combined {@code Iterable}
+ */
+ public static <T> Iterable<T> combine(final Iterable<? extends T> first, final Iterable<? extends T> second, final Iterable<? extends T> third) {
+ return combine(combine(first, second), third);
+ }
+
+ /**
+ * Combine four {@code Iterable}s into one.
+ *
+ * @param first the first {@code Iterable}
+ * @param second the second {@code Iterable}
+ * @param third the third {@code Iterable}
+ * @param fourth the fourth {@code Iterable}
+ * @return a new combined {@code Iterable}
+ */
+ public static <T> Iterable<T> combine(final Iterable<? extends T> first, final Iterable<? extends T> second, final Iterable<? extends T> third, final Iterable<? extends T> fourth) {
+ return combine(combine(first, second), combine(third, fourth));
+ }
}
16 years, 5 months
JBoss Remoting SVN: r4432 - remoting2/tags.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 16:09:43 -0400 (Sat, 26 Jul 2008)
New Revision: 4432
Added:
remoting2/tags/2.2.2-SP9/
Log:
Copied: remoting2/tags/2.2.2-SP9 (from rev 4431, remoting2/branches/2.2)
16 years, 5 months
JBoss Remoting SVN: r4431 - remoting2/tags.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 16:05:41 -0400 (Sat, 26 Jul 2008)
New Revision: 4431
Removed:
remoting2/tags/2.2.2-SP9/
Log:
16 years, 5 months
JBoss Remoting SVN: r4430 - remoting2/branches/2.2/docs.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 16:04:35 -0400 (Sat, 26 Jul 2008)
New Revision: 4430
Modified:
remoting2/branches/2.2/docs/README.txt
Log:
JBREM-1011: Added 2.2.2.SP9 release notes.
Modified: remoting2/branches/2.2/docs/README.txt
===================================================================
--- remoting2/branches/2.2/docs/README.txt 2008-07-26 19:59:31 UTC (rev 4429)
+++ remoting2/branches/2.2/docs/README.txt 2008-07-26 20:04:35 UTC (rev 4430)
@@ -27,6 +27,26 @@
in Jira, please create one.
==========================================================================================================
+Release Notes - JBoss Remoting - Version 2.2.2.SP9
+Bug
+
+ * [JBREM-1005] - Prevent build up of cancelled TimerTasks in bisocket transport
+ * [JBREM-1014] - Support injection of socket factory class name into AbstractInvoker
+
+Feature Request
+
+ * [JBREM-1010] - Add feature to declaratively turn on leasing for 2.2.2
+
+Release
+
+ * [JBREM-1011] - Release 2.2.2.SP9
+
+Task
+
+ * [JBREM-1013] - Assure version compatibility with earlier versions of Remoting
+ * [JBREM-1017] - Improve socket timeout log message
+
+==========================================================================================================
Release Notes - JBoss Remoting - Version 2.2.2.SP8
Bug
16 years, 5 months
JBoss Remoting SVN: r4429 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 15:59:31 -0400 (Sat, 26 Jul 2008)
New Revision: 4429
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
Log:
JBREM-1017: Log exceptions at DEBUG level in checkConnection().
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-26 19:58:52 UTC (rev 4428)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-26 19:59:31 UTC (rev 4429)
@@ -80,16 +80,12 @@
}
catch(EOFException eof)
{
- if(log.isTraceEnabled())
- {
- log.trace("socket timeout is set to : " + getTimeout());
- log.trace("EOFException waiting on ACK in readByte().");
- //log.trace("Time waited was " + (System.currentTimeMillis() - startWait));
- }
+ log.debug("EOFException waiting on ACK in read().");
throw eof;
}
catch(IOException e)
{
+ log.debug("IOException when reading in ACK: " + e.getMessage());
log.trace("IOException when reading in ACK", e);
throw e;
}
16 years, 5 months
JBoss Remoting SVN: r4428 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 15:58:52 -0400 (Sat, 26 Jul 2008)
New Revision: 4428
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
Log:
JBREM-1017: Changed readByte() to read() in error message in checkConnection().
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-26 19:55:03 UTC (rev 4427)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-26 19:58:52 UTC (rev 4428)
@@ -78,7 +78,7 @@
}
catch(EOFException eof)
{
- log.debug("EOFException waiting on ACK in readByte().");
+ log.debug("EOFException waiting on ACK in read().");
throw eof;
}
catch(IOException e)
16 years, 5 months
JBoss Remoting SVN: r4427 - remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-26 15:55:03 -0400 (Sat, 26 Jul 2008)
New Revision: 4427
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
Log:
JBREM-1017: Log exceptions at DEBUG level in checkConnection().
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-22 06:43:54 UTC (rev 4426)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/ServerSocketWrapper.java 2008-07-26 19:55:03 UTC (rev 4427)
@@ -78,16 +78,12 @@
}
catch(EOFException eof)
{
- if(log.isTraceEnabled())
- {
- log.trace("socket timeout is set to : " + getTimeout());
- log.trace("EOFException waiting on ACK in readByte().");
- //log.trace("Time waited was " + (System.currentTimeMillis() - startWait));
- }
+ log.debug("EOFException waiting on ACK in readByte().");
throw eof;
}
catch(IOException e)
{
+ log.debug("IOException when reading in ACK: " + e.getMessage());
log.trace("IOException when reading in ACK", e);
throw e;
}
16 years, 5 months
JBoss Remoting SVN: r4426 - remoting2/branches/2.x/docs/guide/en.
by jboss-remoting-commits@lists.jboss.org
Author: trustin
Date: 2008-07-22 02:43:54 -0400 (Tue, 22 Jul 2008)
New Revision: 4426
Modified:
remoting2/branches/2.x/docs/guide/en/chap3.xml
remoting2/branches/2.x/docs/guide/en/chap5.xml
Log:
Fixed overflowing programlistings in the chapter 3 & 5 (6, 9, 10 & 11 needs work too)
Modified: remoting2/branches/2.x/docs/guide/en/chap3.xml
===================================================================
--- remoting2/branches/2.x/docs/guide/en/chap3.xml 2008-07-22 06:38:28 UTC (rev 4425)
+++ remoting2/branches/2.x/docs/guide/en/chap3.xml 2008-07-22 06:43:54 UTC (rev 4426)
@@ -42,14 +42,17 @@
<classname>org.jboss.test.remoting.locator.InvokerLocatorTestCase</classname>:
</para>
- <para><code>new InvokerLocator("http://localhost:1234/services/uri:Test").equals(new InvokerLocator("http://localhost:1234"))</code> returns false</para>
+ <para><literallayout><code>new InvokerLocator("http://localhost:1234/services/uri:Test").equals(
+ new InvokerLocator("http://localhost:1234"))</code> returns <constant>false</constant>
- <para><code>new InvokerLocator("http://localhost:1234/services/uri:Test").equals(new InvokerLocator("http://127.0.0.1:1234"))</code> returns false</para>
+<code>new InvokerLocator("http://localhost:1234/services/uri:Test").equals(
+ new InvokerLocator("http://127.0.0.1:1234"))</code> returns <constant>false</constant>
- <para><code>new InvokerLocator("http://localhost:1234/services/uri:Test").isSameEndpoint(new InvokerLocator("http://localhost:1234"))</code> returns true </para>
+<code>new InvokerLocator("http://localhost:1234/services/uri:Test").isSameEndpoint(
+ new InvokerLocator("http://localhost:1234"))</code> returns <constant>true</constant>
- <para><code>new InvokerLocator("http://localhost:1234/services/uri:Test").isSameEndpoint(new InvokerLocator("http://127.0.0.1:1234"))</code> returns false</para>
-
+<code>new InvokerLocator("http://localhost:1234/services/uri:Test").isSameEndpoint(
+ new InvokerLocator("http://127.0.0.1:1234"))</code> returns <constant>false</constant></literallayout></para>
<para><emphasis role="bold">N.B.</emphasis> As of version 2.4,
<classname>InvokerLocator</classname> uses the class
<classname>java.net.URI</classname>, rather than its original ad hoc parsing
@@ -226,14 +229,14 @@
<code>org.jboss.remoting.transport.socket.TransportServerFactory</code>.
The API for org.jboss.remoting.transport.ClientFactory is:</para>
- <programlisting> public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException;
- public boolean supportsSSL();
+ <programlisting>public ClientInvoker createClientInvoker(InvokerLocator locator, Map config) throws IOException;
+public boolean supportsSSL();
</programlisting>
<para>The API for org.jboss.remoting.transport.ServerFactory is:</para>
- <programlisting> public ServerInvoker createServerInvoker(InvokerLocator locator, Map config) throws IOException;
- public boolean supportsSSL();
+ <programlisting>public ServerInvoker createServerInvoker(InvokerLocator locator, Map config) throws IOException;
+public boolean supportsSSL();
</programlisting>
<para>An example of a transport client factory for the socket transport
@@ -269,4 +272,4 @@
with the following transports: socket, sslsocket, http, https, multiplex,
sslmultiplex, servlet, sslservlet, rmi, sslrmi.</para>
</section>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: remoting2/branches/2.x/docs/guide/en/chap5.xml
===================================================================
--- remoting2/branches/2.x/docs/guide/en/chap5.xml 2008-07-22 06:38:28 UTC (rev 4425)
+++ remoting2/branches/2.x/docs/guide/en/chap5.xml 2008-07-22 06:43:54 UTC (rev 4426)
@@ -59,17 +59,15 @@
<classname>Connector</classname> constructor. For example, the code
fragment</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientLeasePeriod=10000&timeout=120000";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- Connector connector = new Connector(locator);
- connector.create();
- SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
- connector.addInvocationHandler("sample", invocationHandler);
- connector.start();
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientLeasePeriod=10000&timeout=120000";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+Connector connector = new Connector(locator);
+connector.create();
+SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
+connector.addInvocationHandler("sample", invocationHandler);
+connector.start();</programlisting>
<para>creates a server invoker based on the socket transport, directs
it to listen for invocations on port 8084 of host test.somedomain.com,
@@ -87,20 +85,18 @@
configuration map. It also passes in a non-string object, a
<classname>ServerSocketFactory</classname>:</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientLeasePeriod=10000";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 120000);
- config.put(ServerInvoker.SERVER_SOCKET_FACTORY, new MyServerSocketFactory());
- Connector connector = new Connector(locator, config);
- connector.create();
- SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
- connector.addInvocationHandler("sample", invocationHandler);
- connector.start();
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientLeasePeriod=10000";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 120000);
+config.put(ServerInvoker.SERVER_SOCKET_FACTORY, new MyServerSocketFactory());
+Connector connector = new Connector(locator, config);
+connector.create();
+SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
+connector.addInvocationHandler("sample", invocationHandler);
+connector.start();</programlisting>
<para>Note that the value of <code>ServerInvoker.TIMEOUT</code> is
"timeout", and the value of
@@ -118,22 +114,20 @@
<classname>ServerSocketFactory</classname> is passed to it by way of a
setter method:</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientLeasePeriod=10000";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 120000);
- Connector connector = new Connector(locator, config);
- connector.create();
- ServerInvoker serverInvoker = connector.getServerInvoker();
- ServerSocketFactory ssf = new MyServerSocketFactory();
- serverInvoker.setServerSocketFactory(ssf);
- SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
- connector.addInvocationHandler("sample", invocationHandler);
- connector.start();
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientLeasePeriod=10000";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 120000);
+Connector connector = new Connector(locator, config);
+connector.create();
+ServerInvoker serverInvoker = connector.getServerInvoker();
+ServerSocketFactory ssf = new MyServerSocketFactory();
+serverInvoker.setServerSocketFactory(ssf);
+SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
+connector.addInvocationHandler("sample", invocationHandler);
+connector.start();</programlisting>
<para><emphasis role="bold">Note.</emphasis> The
<classname>Connector</classname> creates the server invoker during the
@@ -149,34 +143,33 @@
fragment duplicates the behavior of the first and second examples
above.</para>
- <programlisting>
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 120000);
- Connector connector = new Connector(config);
-
- // Set xml configuration element.
- StringBuffer buf = new StringBuffer();
- buf.append("<?xml version=\"1.0\"?>\n");
- buf.append("<config>");
- buf.append(" <invoker transport=\"socket\">");
- buf.append(" <attribute name=\"serverBindAddress\">test.somedomain.com</attribute>");
- buf.append(" <attribute name=\"serverBindPort\">8084</attribute>");
- buf.append(" <attribute name=\"clientLeasePeriod\">10000</attribute>");
- buf.append(" </invoker>");
- buf.append(" <handlers>");
- buf.append(" <handler subsystem=\"mock\">");
- buf.append(" org.jboss.remoting.transport.mock.SampleInvocationHandler");
- buf.append(" </handler>");
- buf.append(" </handlers>");
- buf.append("</config>");
- ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
- Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
- connector.setConfiguration(xml.getDocumentElement());
-
- connector.create();
- connector.start();
- </programlisting>
+ <programlisting>HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 120000);
+Connector connector = new Connector(config);
+// Set xml configuration element.
+StringBuffer buf = new StringBuffer();
+buf.append("<?xml version=\"1.0\"?>\n");
+buf.append("<config>");
+buf.append(" <invoker transport=\"socket\">");
+buf.append(" <attribute name=\"serverBindAddress\">test.somedomain.com</attribute>");
+buf.append(" <attribute name=\"serverBindPort\">8084</attribute>");
+buf.append(" <attribute name=\"clientLeasePeriod\">10000</attribute>");
+buf.append(" </invoker>");
+buf.append(" <handlers>");
+buf.append(" <handler subsystem=\"mock\">");
+buf.append(" org.jboss.remoting.transport.mock.SampleInvocationHandler");
+buf.append(" </handler>");
+buf.append(" </handlers>");
+buf.append("</config>");
+
+ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
+Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
+connector.setConfiguration(xml.getDocumentElement());
+
+connector.create();
+connector.start();</programlisting>
+
<para>Note that there is no <classname>InvokerLocator</classname> in
this example. If the <classname>Connector</classname> gets an
<classname>InvokerLocator</classname>, it ignores the presence of the
@@ -195,34 +188,32 @@
The following fragment duplicates the behavior of the first and second
examples above.</para>
- <programlisting>
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 120000);
- Connector connector = new Connector(config);
-
- // Create ServerConfiguration object for socket transport
- ServerConfiguration serverConfig = new ServerConfiguration("socket");
-
- // Add invokerLocatorParameters (applicable to client and server)
- Map locatorConfig = new HashMap();
- locatorConfig.put("serverBindAddress", "test.somedomain.com");
- locatorConfig.put("serverBindPort", "8084");
- serverConfig.setInvokerLocatorParameters(locatorConfig);
-
- // Add serverParameters (applicable to server)
- Map serverParameters = new HashMap();
- locatorConfig.put("clientLeasePeriod", "10000");
- serverConfig.setServerParameters(serverParameters);
-
- // Add invocation handlers
- Map handlers = new HashMap();
- handlers.put("mock", "org.jboss.remoting.transport.mock.SampleInvocationHandler");
- serverConfig.setInvocationHandlers(handlers);
+ <programlisting>HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 120000);
+Connector connector = new Connector(config);
- connector.setServerConfiguration(serverConfig);
- connector.create();
- connector.start();
- </programlisting>
+// Create ServerConfiguration object for socket transport
+ServerConfiguration serverConfig = new ServerConfiguration("socket");
+
+// Add invokerLocatorParameters (applicable to client and server)
+Map locatorConfig = new HashMap();
+locatorConfig.put("serverBindAddress", "test.somedomain.com");
+locatorConfig.put("serverBindPort", "8084");
+serverConfig.setInvokerLocatorParameters(locatorConfig);
+
+// Add serverParameters (applicable to server)
+Map serverParameters = new HashMap();
+locatorConfig.put("clientLeasePeriod", "10000");
+serverConfig.setServerParameters(serverParameters);
+
+// Add invocation handlers
+Map handlers = new HashMap();
+handlers.put("mock", "org.jboss.remoting.transport.mock.SampleInvocationHandler");
+serverConfig.setInvocationHandlers(handlers);
+
+connector.setServerConfiguration(serverConfig);
+connector.create();
+connector.start();</programlisting>
<para>For more information about <classname>ServerConfiguration</classname>,
see the section "Declarative configuration: POJOs".</para>
@@ -250,24 +241,22 @@
invoker that is listening on port 8084 on the test.somedomain.com
address would be:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
- <attribute name="<emphasis role="bold">InvokerLocator</emphasis>">
- <![CDATA[<emphasis role="bold">socket://test.somedomain.com:8084</emphasis>]]>
- </attribute>
- <attribute name="Configuration">
- <config>
- <handlers>
- <handler <emphasis role="bold">subsystem</emphasis>="mock">
- <emphasis role="bold">org.jboss.remoting.transport.mock.MockServerInvocationHandler</emphasis>
- </handler>
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
+ <attribute name="<emphasis role="bold">InvokerLocator</emphasis>">
+ <![CDATA[<emphasis role="bold">socket://test.somedomain.com:8084</emphasis>]]>
+ </attribute>
+ <attribute name="Configuration">
+ <config>
+ <handlers>
+ <handler <emphasis role="bold">subsystem</emphasis>="mock">
+ <emphasis role="bold">org.jboss.remoting.transport.mock.MockServerInvocationHandler</emphasis>
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
<para>Note that all the server side socket invoker configurations will
be set to their default values in this case. Also, it is important to
@@ -286,37 +275,35 @@
attribute needs to be used by the client. An example using this form
of configuration is as follows:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <emphasis role="bold">
- <invoker transport="socket">
- <attribute name="numAcceptThreads">1</attribute>
- <attribute name="maxPoolSize">303</attribute>
- <attribute name="clientMaxPoolSize" isParam="true">304</attribute>
- <attribute name="socketTimeout">60000</attribute>
- <attribute name="serverBindAddress">192.168.0.82</attribute>
- <attribute name="serverBindPort">6666</attribute>
- <attribute name="clientConnectAddress">216.23.33.2</attribute>
- <attribute name="clientConnectPort">7777</attribute>
- <attribute name="enableTcpNoDelay" isParam="true">false</attribute>
- <attribute name="backlog">200</attribute>
- </invoker>
- </emphasis>
- <handlers>
- <handler subsystem="mock">
- org.jboss.remoting.transport.mock.MockServerInvocationHandler
- </handler>
- </handlers>
- </config>
- </attribute>
+ <attribute name="Configuration">
+ <config>
+ <emphasis role="bold">
+ <invoker transport="socket">
+ <attribute name="numAcceptThreads">1</attribute>
+ <attribute name="maxPoolSize">303</attribute>
+ <attribute name="clientMaxPoolSize" isParam="true">304</attribute>
+ <attribute name="socketTimeout">60000</attribute>
+ <attribute name="serverBindAddress">192.168.0.82</attribute>
+ <attribute name="serverBindPort">6666</attribute>
+ <attribute name="clientConnectAddress">216.23.33.2</attribute>
+ <attribute name="clientConnectPort">7777</attribute>
+ <attribute name="enableTcpNoDelay" isParam="true">false</attribute>
+ <attribute name="backlog">200</attribute>
+ </invoker>
+ </emphasis>
+ <handlers>
+ <handler subsystem="mock">
+ org.jboss.remoting.transport.mock.MockServerInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
- </mbean>
- </programlisting>
+</mbean></programlisting>
<para>Also note that <code>${jboss.bind.address}</code> can be used
for any of the bind address properties, which will be replaced with
@@ -333,24 +320,22 @@
express a locator uri path of 'foo/bar' via the InvokerLocator
attribute as:</para>
- <programlisting> <attribute name="InvokerLocator"><![CDATA[socket://test.somedomain.com:8084/<emphasis
- role="bold">foo/bar</emphasis>]]></attribute>
- </programlisting>
+ <programlisting><attribute name="InvokerLocator">
+ <![CDATA[socket://test.somedomain.com:8084/<emphasis role="bold">foo/bar</emphasis>]]>
+</attribute></programlisting>
<para>To include the path using the Configuration attribute, can
include a specific 'path' attribute. So the same InvokerLocator can be
expressed as follows with the Configuration attribute:</para>
- <programlisting>
- <attribute name="Configuration">
- <config>
- <invoker transport="socket">
- <attribute name="serverBindAddress">test.somedomain.com</attribute>
- <attribute name="serverBindPort">8084</attribute>
- <emphasis role="bold"><attribute name="path">foo/bar</attribute></emphasis>
- </invoker>
- ...
- </programlisting>
+ <programlisting><attribute name="Configuration">
+ <config>
+ <invoker transport="socket">
+ <attribute name="serverBindAddress">test.somedomain.com</attribute>
+ <attribute name="serverBindPort">8084</attribute>
+ <emphasis role="bold"><attribute name="path">foo/bar</attribute></emphasis>
+ </invoker>
+ ...</programlisting>
<para>Note: The value for the 'path' attribute should NOT start or end
with a / (slash).</para>
@@ -390,55 +375,58 @@
</listitem>
</itemizedlist>
- <para>An sample remoting-beans.xml file which duplicates the example in the
+ <para>A sample remoting-beans.xml file which duplicates the example in the
previous sections is:</para>
- <programlisting>
- <?xml version="1.0" encoding="UTF-8"?>
- <deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="remoting:invocationHandler" class="org.jboss.remoting.transport.mock.SampleInvocationHandler"/>
+ <bean name="remoting:invocationHandler"
+ class="org.jboss.remoting.transport.mock.SampleInvocationHandler"/>
- <bean name="remoting:serverConfiguration" class="org.jboss.remoting.ServerConfiguration">
- <constructor>
- <parameter>socket</parameter>
- </constructor>
- <property name="invokerLocatorParameters">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry>
- <key>serverBindAddress</key>
- <value>test.somedomain.com</value>
- </entry>
- <entry>
- <key>serverBindPort</key>
- <value>8084</value>
- </entry>
- </map>
- </property>
- <property name="serverParameters">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry>
- <key>clientLeasePeriod</key>
- <value>10000</value>
- </entry>
- </map>
- </property>
- <property name="invocationHandlers">
- <map keyClass="java.lang.String" valueClass="org.jboss.remoting.ServerInvocationHandler">
- <entry>
- <key>mock</key>
- <value><inject bean="remoting:invocationHandler"/></value>
- </entry>
- </map>
- </property>
- </bean>
+ <bean name="remoting:serverConfiguration"
+ class="org.jboss.remoting.ServerConfiguration">
+ <constructor>
+ <parameter>socket</parameter>
+ </constructor>
+ <property name="invokerLocatorParameters">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+ <key>serverBindAddress</key>
+ <value>test.somedomain.com</value>
+ </entry>
+ <entry>
+ <key>serverBindPort</key>
+ <value>8084</value>
+ </entry>
+ </map>
+ </property>
+ <property name="serverParameters">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry>
+ <key>clientLeasePeriod</key>
+ <value>10000</value>
+ </entry>
+ </map>
+ </property>
+ <property name="invocationHandlers">
+ <map keyClass="java.lang.String"
+ valueClass="org.jboss.remoting.ServerInvocationHandler">
+ <entry>
+ <key>mock</key>
+ <value><inject bean="remoting:invocationHandler"/></value>
+ </entry>
+ </map>
+ </property>
+ </bean>
- <bean name="remoting:connector" class="org.jboss.remoting.transport.Connector">
- <property name="serverConfiguration"><inject bean="remoting:serverConfiguration"/></property>
- </bean>
+ <bean name="remoting:connector" class="org.jboss.remoting.transport.Connector">
+ <property name="serverConfiguration">
+ <inject bean="remoting:serverConfiguration"/>
+ </property>
+ </bean>
- </deployment>
- </programlisting>
+</deployment></programlisting>
<para>For more information about using the JBoss Microcontainer, see
<ulink url="http://www.jboss.org/jbossmc/">
@@ -484,14 +472,12 @@
the configuration parameters on the
<classname>InvokerLocator</classname>. For example, the fragment</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientMaxPoolSize=10&timeout=360000";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- Client client = new Client(locator);
- client.connect();
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientMaxPoolSize=10&timeout=360000";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+Client client = new Client(locator);
+client.connect();</programlisting>
<para>creates a <classname>Client</classname> using the socket transport
to connect to a server on host test.somedomain.com, listening on port
@@ -505,17 +491,15 @@
configuration map. It also passes in a non-string object, a
<classname>SocketFactory</classname>:</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientMaxPoolSize=10";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 360000);
- config.put(Remoting.CUSTOM_SOCKET_FACTORY, new MySocketFactory());
- Client client = new Client(locator, config);
- client.connect();
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientMaxPoolSize=10";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 360000);
+config.put(Remoting.CUSTOM_SOCKET_FACTORY, new MySocketFactory());
+Client client = new Client(locator, config);
+client.connect();</programlisting>
<para>Note that the value of <code>ServerInvoker.TIMEOUT</code> is
"timeout", and the value of <code>Remoting.CUSTOM_SOCKET_FACTORY</code>
@@ -531,19 +515,17 @@
<classname>SocketFactory</classname> is passed to it by way of a setter
method:</para>
- <programlisting>
- String locatorURI = "socket://test.somedomain.com:8084";
- String params = "/?clientMaxPoolSize=10";
- locatorURI += params;
- InvokerLocator locator = new InvokerLocator(locatorURI);
- HashMap config = new HashMap();
- config.put(ServerInvoker.TIMEOUT, 360000);
- Client client = new Client(locator, config);
- client.connect();
- SocketFactory sf = new MySocketFactory();
- ClientInvoker clientInvoker = client.getInvoker();
- clientInvoker.setSocketFactory(sf);
- </programlisting>
+ <programlisting>String locatorURI = "socket://test.somedomain.com:8084";
+String params = "/?clientMaxPoolSize=10";
+locatorURI += params;
+InvokerLocator locator = new InvokerLocator(locatorURI);
+HashMap config = new HashMap();
+config.put(ServerInvoker.TIMEOUT, 360000);
+Client client = new Client(locator, config);
+client.connect();
+SocketFactory sf = new MySocketFactory();
+ClientInvoker clientInvoker = client.getInvoker();
+clientInvoker.setSocketFactory(sf);</programlisting>
<para><emphasis role="bold">Note.</emphasis> The
<classname>Client</classname> creates the client invoker during the call
@@ -568,40 +550,36 @@
ServerInvocationHandler handler)</code>. For example (from
<code>org.jboss.remoting.samples.simple.SimpleServer</code>):</para>
- <programlisting>
- InvokerLocator locator = new InvokerLocator(locatorURI);
- Connector connector = new Connector();
- connector.setInvokerLocator(locator.getLocatorURI());
- connector.create();
+ <programlisting>InvokerLocator locator = new InvokerLocator(locatorURI);
+Connector connector = new Connector();
+connector.setInvokerLocator(locator.getLocatorURI());
+connector.create();
- SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
- // first parameter is sub-system name. can be any String value.
- connector.addInvocationHandler("sample", invocationHandler);
+SampleInvocationHandler invocationHandler = new SampleInvocationHandler();
+// first parameter is sub-system name. can be any String value.
+connector.addInvocationHandler("sample", invocationHandler);
- connector.start();
- </programlisting>
+connector.start();</programlisting>
<para>To pass the handler by ObjectName, call
<code>Connector::addInvocationHandler(String subsystem, ObjectName
handlerObjectName)</code> . For example (from
<code>org.jboss.test.remoting.handler.mbean.ServerTest</code>):</para>
- <programlisting>
- MBeanServer server = MBeanServerFactory.createMBeanServer();
- InvokerLocator locator = new InvokerLocator(locatorURI);
- Connector connector = new Connector();
- connector.setInvokerLocator(locator.getLocatorURI());
- connector.start();
+ <programlisting>MBeanServer server = MBeanServerFactory.createMBeanServer();
+InvokerLocator locator = new InvokerLocator(locatorURI);
+Connector connector = new Connector();
+connector.setInvokerLocator(locator.getLocatorURI());
+connector.start();
- server.registerMBean(connector, new ObjectName("test:type=connector,transport=socket"));
+server.registerMBean(connector, new ObjectName("test:type=connector,transport=socket"));
- // now create Mbean handler and register with mbean server
- MBeanHandler handler = new MBeanHandler();
- ObjectName objName = new ObjectName("test:type=handler");
- server.registerMBean(handler, objName);
+// now create Mbean handler and register with mbean server
+MBeanHandler handler = new MBeanHandler();
+ObjectName objName = new ObjectName("test:type=handler");
+server.registerMBean(handler, objName);
- connector.addInvocationHandler("test", objName);
- </programlisting>
+connector.addInvocationHandler("test", objName);</programlisting>
<para>Is important to note that if not starting the Connector via the
service configuration, will need to explicitly register it with the
@@ -612,13 +590,11 @@
for the handler, which will instantiate the handler instance upon startup
(which requires there be a void parameter constructor), such as:</para>
- <programlisting>
- <handlers>
- <handler subsystem="mock">
- org.jboss.remoting.transport.mock.MockServerInvocationHandler
- </handler>
- </handlers>
- </programlisting>
+ <programlisting><handlers>
+ <handler subsystem="mock">
+ org.jboss.remoting.transport.mock.MockServerInvocationHandler
+ </handler>
+</handlers></programlisting>
<para>where MockServerInvocationHandler will be constructed upon startup
and registered with the Connector as a handler.</para>
@@ -629,11 +605,9 @@
<code>mbeanhandler-service.xml</code> under remoting tests for full
example):</para>
- <programlisting>
- <handlers>
- <handler subsystem="mock">test:type=handler</handler>
- </handlers>
- </programlisting>
+ <programlisting><handlers>
+ <handler subsystem="mock">test:type=handler</handler>
+</handlers></programlisting>
<para>The only requirement for this configuration is that the handler
MBean must already be created and registered with the MBeanServer at the
@@ -808,12 +782,10 @@
add the configuration attribute to the service xml) with the following xml
element:</para>
- <programlisting>
- <domains>
- <domain>domain1</domain>
- <domain>domain2</domain>
- </domains>
- </programlisting>
+ <programlisting><domains>
+ <domain>domain1</domain>
+ <domain>domain2</domain>
+</domains></programlisting>
<para>where <code>domain1</code> and <code>domain2</code> are the two
domains you would like the detector to accept. This will cause the
@@ -824,10 +796,8 @@
(or add the configuration attribute to the service xml) with the following
xml element:</para>
- <programlisting>
- <domains>
- </domains>
- </programlisting>
+ <programlisting><domains>
+</domains></programlisting>
<para>This will cause the detector to accept all detections from any
domain.</para>
@@ -839,29 +809,27 @@
messages from local server invokers. This will be false by default, so
maintains the same behavior as previous releases. For example:</para>
- <programlisting> <domains>
- <domain>domain1</domain>
- <domain>domain2</domain>
- </domains>
- <local/> </programlisting>
+ <programlisting><domains>
+ <domain>domain1</domain>
+ <domain>domain2</domain>
+</domains>
+<local/></programlisting>
<para>An example entry of a Multicast detector in the jboss-service.xml
that accepts detections only from the roxanne and sparky domains using
port 5555, including servers in the same jvm, is as follows:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.detection.multicast.MulticastDetector"
- name="jboss.remoting:service=Detector,transport=multicast">
- <attribute name="Port">5555</attribute>
- <attribute name="Configuration">
- <domains>
- <domain>roxanne</domain>
- <domain>sparky</domain>
- </domains>
- <local/>
- </attribute>
- </mbean>
- </programlisting>
+ <programlisting><mbean code="org.jboss.remoting.detection.multicast.MulticastDetector"
+ name="jboss.remoting:service=Detector,transport=multicast">
+ <attribute name="Port">5555</attribute>
+ <attribute name="Configuration">
+ <domains>
+ <domain>roxanne</domain>
+ <domain>sparky</domain>
+ </domains>
+ <local/>
+ </attribute>
+</mbean></programlisting>
<bridgehead>Global Detector Configuration</bridgehead>
@@ -905,13 +873,11 @@
attribute within the remoting-service.xml (or anywhere else the service is
defined). For example:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.detection.jndi.JNDIDetector"
- name="jboss.remoting:service=Detector,transport=jndi">
- <attribute name="Host">localhost</attribute>
- <attribute name="Port">5555</attribute>
- </mbean>
- </programlisting>
+ <programlisting><mbean code="org.jboss.remoting.detection.jndi.JNDIDetector"
+ name="jboss.remoting:service=Detector,transport=jndi">
+ <attribute name="Host">localhost</attribute>
+ <attribute name="Port">5555</attribute>
+</mbean></programlisting>
<para>If the JNDIDetector is started without the Host attribute being set,
it will try to start a local JNP instance (the JBoss JNDI server
@@ -999,7 +965,8 @@
connect to addresses different than the bind addresses, and a set of connect
addresses may be specified with a "connecthomes" parameter:</para>
- <programlisting>socket://multihome/?homes=10.32.4.2:6500!192.168.4.2:6501&connecthomes=10.32.42.2:7500!192.168.42.2:7501</programlisting>
+ <programlisting>socket://multihome/?homes=10.32.4.2:6500!192.168.4.2:6501
+ &connecthomes=10.32.42.2:7500!192.168.42.2:7501</programlisting>
<para>specifies a server that binds to 10.32.4.2:6500 and 192.168.4.2:6501,
as before, but now a client connects to it using the addresses
@@ -1009,32 +976,30 @@
files and *-beans.xml POJO files. The following MBean definition is
equivalent to the preceding locator:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="socket">
- <emphasis role="bold">
- <attribute name="homes">
- <home>10.32.4.2:6500</home>
- <home>192.168.4.2:6501</home>
- </attribute>
- <attribute name="connecthomes">
- <connecthome>10.32.42.2:7500</connecthome>
- <connecthome>192.168.42.2:7501</connecthome>
- </attribute>
- </emphasis>
- </invoker>
- <handlers>
- ...
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="socket">
+ <emphasis role="bold">
+ <attribute name="homes">
+ <home>10.32.4.2:6500</home>
+ <home>192.168.4.2:6501</home>
+ </attribute>
+ <attribute name="connecthomes">
+ <connecthome>10.32.42.2:7500</connecthome>
+ <connecthome>192.168.42.2:7501</connecthome>
+ </attribute>
+ </emphasis>
+ </invoker>
+ <handlers>
+ ...
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
<para>The "serverBindPort" and "clientConnectPort" attributes may be used to
give default values for bind ports and connect ports, respectively.</para>
@@ -1042,27 +1007,25 @@
<para>The same server may be configured with the
<classname>org.jboss.remoting.ServerInvocation</classname> object as well.
For example,</para>
- <programlisting>
- Connector connector = new Connector();
+ <programlisting>Connector connector = new Connector();
- // Create ServerConfiguration object for socket transport
- ServerConfiguration serverConfig = new ServerConfiguration("socket");
+// Create ServerConfiguration object for socket transport
+ServerConfiguration serverConfig = new ServerConfiguration("socket");
- // Add invokerLocatorParameters (applicable to client and server)
- Map locatorConfig = new HashMap();
- <emphasis role="bold">
- locatorConfig.put("homes", "10.32.4.2:6500!192.168.4.2:6501");
- locatorConfig.put("connecthomes", "10.32.42.2:7500!192.168.42.2:7501");
- </emphasis>
- serverConfig.setInvokerLocatorParameters(locatorConfig);
+// Add invokerLocatorParameters (applicable to client and server)
+Map locatorConfig = new HashMap();
+<emphasis role="bold">
+locatorConfig.put("homes", "10.32.4.2:6500!192.168.4.2:6501");
+locatorConfig.put("connecthomes", "10.32.42.2:7500!192.168.42.2:7501");
+</emphasis>
+serverConfig.setInvokerLocatorParameters(locatorConfig);
- // Add invocation handlers
- ...
+// Add invocation handlers
+...
- connector.setServerConfiguration(serverConfig);
- connector.create();
- connector.start();
- </programlisting>
+connector.setServerConfiguration(serverConfig);
+connector.create();
+connector.start();</programlisting>
<para>is equivalent to the preceding MBean definition.</para>
@@ -1083,19 +1046,17 @@
<classname>org.jboss.remoting.socketfactory.SocketCreationListener</classname>
</para>
- <programlisting>
- public interface SocketCreationListener
- {
- /**
- * Called when a socket has been created.
- *
- * @param socket socket that has been created
- * @param source SocketFactory or ServerSocket that created the socket
- * @throws IOException
- */
- void socketCreated(Socket socket, Object source) throws IOException;
- }
- </programlisting>
+ <programlisting>public interface SocketCreationListener
+{
+ /**
+ * Called when a socket has been created.
+ *
+ * @param socket socket that has been created
+ * @param source SocketFactory or ServerSocket that created the socket
+ * @throws IOException
+ */
+ void socketCreated(Socket socket, Object source) throws IOException;
+}</programlisting>
<para>Socket creation listeners can be configured through the use of
the keys
@@ -1124,9 +1085,7 @@
<methodname>org.jboss.remoting.Client.getAddressSeenByServer()</methodname>,
with signature</para>
- <programlisting>
- public InetAddress getAddressSeenByServer() throws Throwable
- </programlisting>
+ <programlisting>public InetAddress getAddressSeenByServer() throws Throwable</programlisting>
<para>returns the IP address of the client as seen by the server. On
the server side, the same IP address is placed in the request payload
@@ -1136,14 +1095,12 @@
<classname>org.jboss.remoting.ServerInvocationHandler</classname> as
follows:</para>
- <programlisting>
- public Object invoke(InvocationRequest invocation throws Throwable
- {
- ...
- InetAddress address = invocation.getRequestPayload().get(Remoting.CLIENT_ADDRESS);
- ...
- }
- </programlisting>
+ <programlisting>public Object invoke(InvocationRequest invocation throws Throwable
+{
+ ...
+ InetAddress address = invocation.getRequestPayload().get(Remoting.CLIENT_ADDRESS);
+ ...
+}</programlisting>
</section>
@@ -1153,13 +1110,11 @@
<para><classname>org.jboss.remoting.InvokerLocator</classname> will now
accept IPv6 IP addresses. For example,</para>
- <programlisting>
- socket://[::1]:3333/?timeout=10000
- socket://[::]:4444/?timeout=10000
- socket://[::ffff:127.0.0.1]:5555/?timeout=10000
- socket://[fe80::205:9aff:fe3c:7800%7]:6666/?timeout=10000
- socket://multihome/?homes=[fe80::205:9aff:fe3c:7800%7]:7777![fe80::214:22ff:feef:68bb%4]:8888
- </programlisting>
+ <programlisting>socket://[::1]:3333/?timeout=10000
+socket://[::]:4444/?timeout=10000
+socket://[::ffff:127.0.0.1]:5555/?timeout=10000
+socket://[fe80::205:9aff:fe3c:7800%7]:6666/?timeout=10000
+socket://multihome/?homes=[fe80::205:9aff:fe3c:7800%7]:7777![fe80::214:22ff:feef:68bb%4]:8888</programlisting>
</section>
<section>
@@ -1167,11 +1122,9 @@
<para>Multiple clients may share a single client invoker. For example, in the code</para>
- <programlisting>
- InvokerLocator locator = new InvokerLocator("socket://127.0.0.1:5555");
- Client client1 = new Client(locator);
- Client client2 = new Client(locator);
- </programlisting>
+ <programlisting>InvokerLocator locator = new InvokerLocator("socket://127.0.0.1:5555");
+Client client1 = new Client(locator);
+Client client2 = new Client(locator);</programlisting>
<para><code>client1</code> and <code>client2</code> will both
communicate with the server through a single
@@ -1185,13 +1138,12 @@
<code>Client.INVOKER_DESTRUCTION_DELAY</code> (actual value
"invokerDestructionDelay"). For example,</para>
- <programlisting>
- InvokerLocator locator = new InvokerLocator("socket://127.0.0.1:5555/?invokerDestructionDelay=5000");
- Client client = new Client(locator);
- client.connect();
- ...
- client.disconnect();
- </programlisting>
+ <programlisting>InvokerLocator locator =
+ new InvokerLocator("socket://127.0.0.1:5555/?invokerDestructionDelay=5000");
+Client client = new Client(locator);
+client.connect();
+...
+client.disconnect();</programlisting>
<para>will cause <code>client</code> to delay the destruction of its
client invoker (assuming <code>client</code> is the only user), by 5000
@@ -1285,37 +1237,27 @@
in the InvokerLocator, the server will bind to the address of the local
host, as determined by the call</para>
- <programlisting>
- InetAddress.getLocalHost().getHostAddress();
- </programlisting>
+ <programlisting>InetAddress.getLocalHost().getHostAddress();</programlisting>
- <para>In other words, the logic is
- </para>
+ <para>In other words, the logic is</para>
+ <programlisting>if (serverBindAddress is set)
+ use it
+else if (the host is present in the InvokerLocator and clientConnectAddress is not set)
+ use host from InvokerLocator
+else
+ use local host address</programlisting>
- <programlisting>
- if (serverBindAddress is set)
- use it
- else if (the host is present in the InvokerLocator and clientConnectAddress is not set)
- use host from InvokerLocator
- else
- use local host address
- </programlisting>
-
<para>There is one other exception. If the InvokerLocator address is
0.0.0.0 and the system property called 'remoting.bind_by_host' is set to
true, then the local host name will be used, as determined by the call</para>
- <programlisting>
- InetAddress.getLocalHost().getHostName();
- </programlisting>
+ <programlisting>InetAddress.getLocalHost().getHostName();</programlisting>
<para>If 'remoting.bind_by_host' is set to false, then local host address will
be used. To facilitate setting this property, the following static variable is
defined in <classname>InvokerLocator</classname>:</para>
- <programlisting>
- public static final String BIND_BY_HOST = "remoting.bind_by_host";
- </programlisting>
+ <programlisting>public static final String BIND_BY_HOST = "remoting.bind_by_host";</programlisting>
<para>If the serverBindPort property is set, it will be used. If this
value is 0 or a negative number, then the next available port will be
@@ -1804,9 +1746,7 @@
<para>If a request on the HTTP transport is made with the
<classname>org.jboss.remoting.Client</classname> method</para>
- <programlisting>
- public Object invoke(Object param, Map metadata) throws Throwable
- </programlisting>
+ <programlisting>public Object invoke(Object param, Map metadata) throws Throwable</programlisting>
<para>then
<classname>org.jboss.remoting.transport.http.HTTPClientInvoker</classname>
@@ -1816,13 +1756,11 @@
(actual value "ResponseHeaders"). For example, the response header "Date"
can be retrieved as follows:</para>
- <programlisting>
- Object payload = ... ;
- HashMap metadata = new HashMap();
- client.invoke(payload, metadata);
- Map responseHeaders = (Map) metadata.get(HTTPMetadataConstants.RESPONSE_HEADERS);
- String date = (String) responseHeaders.get("Date");
- </programlisting>
+ <programlisting>Object payload = ... ;
+HashMap metadata = new HashMap();
+client.invoke(payload, metadata);
+Map responseHeaders = (Map) metadata.get(HTTPMetadataConstants.RESPONSE_HEADERS);
+String date = (String) responseHeaders.get("Date");</programlisting>
<bridgehead>CR/LF in HTTP transport</bridgehead>
@@ -1870,18 +1808,16 @@
<para>An example would be:</para>
- <programlisting>
- Map metadata = new HashMap();
- ...
+ <programlisting>Map metadata = new HashMap();
+...
- // proxy info
- metadata.put("http.proxyHost", "ginger");
- metadata.put("http.proxyPort", "80");
+// proxy info
+metadata.put("http.proxyHost", "ginger");
+metadata.put("http.proxyPort", "80");
- ...
+...
- response = client.invoke(payload, metadata);
- </programlisting>
+response = client.invoke(payload, metadata);</programlisting>
<para>The http.proxyPort property is not required and if not present,
will use default of 80. Note: setting the proxy config in this way can
@@ -1993,26 +1929,24 @@
existing service xml or creating a new one. The following is an example
of how to declare a Connector that uses the servlet invoker:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Servlet"
- display-name="Servlet transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Servlet"
+ display-name="Servlet transport Connector">
- <attribute name="InvokerLocator">
- servlet://localhost:8080/servlet-invoker/ServerInvokerServlet
- </attribute>
+ <attribute name="InvokerLocator">
+ servlet://localhost:8080/servlet-invoker/ServerInvokerServlet
+ </attribute>
- <attribute name="Configuration">
- <config>
- <handlers>
- <handler subsystem="test">
- org.jboss.test.remoting.transport.web.WebInvocationHandler
- </handler>
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <handlers>
+ <handler subsystem="test">
+ org.jboss.test.remoting.transport.web.WebInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
<para>An important point of configuration to note is that the value for
the InvokerLocator attribute is the exact url used to access the servlet
@@ -2032,36 +1966,41 @@
the WEB-INF directory is located the web.xml file. This is a standard
web configuration file and should look like:</para>
- <programlisting> <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE web-app PUBLIC
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
- <web-app>
- <servlet>
- <servlet-name>ServerInvokerServlet</servlet-name>
- <description>The ServerInvokerServlet receives requests via HTTP
- protocol from within a web container and passes it onto the
- ServletServerInvoker for processing.
- </description>
- <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
- <init-param>
- <param-name>invokerName</param-name>
- <param-value>jboss.remoting:service=invoker,transport=servlet</param-value>
- <description>The servlet server invoker</description>
- <!--
- <param-name>locatorUrl</param-name>
- <param-value>servlet://localhost:8080/servlet-invoker/ServerInvokerServlet</param-value>
- <description>The servlet server invoker locator url</description>
- -->
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>ServerInvokerServlet</servlet-name>
- <url-pattern>/ServerInvokerServlet/*</url-pattern>
- </servlet-mapping>
- </web-app></programlisting>
+<web-app>
+ <servlet>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <description>
+ The ServerInvokerServlet receives requests via HTTP protocol from
+ within a web container and passes it onto the ServletServerInvoker
+ for processing.
+ </description>
+ <servlet-class>
+ org.jboss.remoting.transport.servlet.web.ServerInvokerServlet
+ </servlet-class>
+ <init-param>
+ <param-name>invokerName</param-name>
+ <param-value>jboss.remoting:service=invoker,transport=servlet</param-value>
+ <description>The servlet server invoker</description>
+ <!--
+ <param-name>locatorUrl</param-name>
+ <param-value>
+ servlet://localhost:8080/servlet-invoker/ServerInvokerServlet
+ </param-value>
+ <description>The servlet server invoker locator url</description>
+ -->
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ </servlet-mapping>
+</web-app></programlisting>
<para>There are two ways in which the servlet can obtain a reference to
the servlet server invoker it needs to pass its request onto. The first
@@ -2120,54 +2059,60 @@
<para>An example of the mbean service xml for deploying the ssl servlet
server invoker would be:</para>
- <programlisting> <?xml version="1.0" encoding="UTF-8"?>
-
- <server>
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<server>
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:service=Connector,transport=SSLServlet"
display-name="SSL Servlet transport Connector">
- <attribute name="InvokerLocator">
- sslservlet://localhost:8443/servlet-invoker/ServerInvokerServlet
- </attribute>
- <attribute name="Configuration">
- <config>
- <handlers>
- <handler subsystem="test">org.jboss.test.remoting.transport.web.WebInvocationHandler</handler>
- </handlers>
- </config>
- </attribute>
+ <attribute name="InvokerLocator">
+ sslservlet://localhost:8443/servlet-invoker/ServerInvokerServlet
+ </attribute>
+ <attribute name="Configuration">
+ <config>
+ <handlers>
+ <handler subsystem="test">
+ org.jboss.test.remoting.transport.web.WebInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
</mbean>
- </server> </programlisting>
+</server></programlisting>
<para>An example of servlet-invoker.war/WEB-INF/web.xml for the ssl
server invoker servlet would be:</para>
- <programlisting> <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE web-app PUBLIC
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
- <web-app>
- <servlet>
- <servlet-name>ServerInvokerServlet</servlet-name>
- <description>The ServerInvokerServlet receives requests via HTTP
- protocol from within a web container and passes it onto the
- ServletServerInvoker for processing.
- </description>
- <servlet-class>org.jboss.remoting.transport.servlet.web.ServerInvokerServlet</servlet-class>
- <init-param>
- <param-name>locatorUrl</param-name>
- <param-value>sslservlet://localhost:8443/servlet-invoker/ServerInvokerServlet</param-value>
- <description>The servlet server invoker locator url</description>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>ServerInvokerServlet</servlet-name>
- <url-pattern>/ServerInvokerServlet/*</url-pattern>
- </servlet-mapping>
- </web-app> </programlisting>
+<web-app>
+ <servlet>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <description>
+ The ServerInvokerServlet receives requests via HTTP protocol from
+ within a web container and passes it onto the ServletServerInvoker
+ for processing.
+ </description>
+ <servlet-class>
+ org.jboss.remoting.transport.servlet.web.ServerInvokerServlet
+ </servlet-class>
+ <init-param>
+ <param-name>locatorUrl</param-name>
+ <param-value>
+ sslservlet://localhost:8443/servlet-invoker/ServerInvokerServlet
+ </param-value>
+ <description>The servlet server invoker locator url</description>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ </servlet-mapping>
+</web-app></programlisting>
</section>
<section>
@@ -2196,9 +2141,7 @@
<classname>org.jboss.remoting.Client</classname> is created, or it may be
included in the metadata map passed to</para>
- <programlisting>
- public Object invoke(Object param, Map metadata) throws Throwable;
- </programlisting>
+ <programlisting>public Object invoke(Object param, Map metadata) throws Throwable;</programlisting>
.
<para>This will cause the http client invoker to not throw an exception,
but instead return the data from the web server error stream. In the case
@@ -2646,8 +2589,8 @@
side). This can be done by the following method call within the
MarshalFactory:</para>
- <programlisting>public static void addMarshaller(String dataType, Marshaller marshaller, UnMarshaller unMarshaller)
- </programlisting>
+ <programlisting>public static void addMarshaller(
+ String dataType, Marshaller marshaller, UnMarshaller unMarshaller)</programlisting>
<para>The dataType passed can be any String value desired. For example,
could add custom InvocationMarshaller and InvocationUnMarshaller with the
@@ -2684,29 +2627,25 @@
simply add the datatype, marshaller, and unmarshaller parameters to the
defined InvokerLocator attribute value. For example:</para>
- <programlisting>
- <attribute name="InvokerLocator">
- <![CDATA[socket://${jboss.bind.address}:8084/?datatype=invocation&
- marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&
- unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]]>
- </attribute>
- </programlisting>
+ <programlisting><attribute name="InvokerLocator">
+ <![CDATA[socket://${jboss.bind.address}:8084/?datatype=invocation&
+ marshaller=org.jboss.invocation.unified.marshall.InvocationMarshaller&
+ unmarshaller=org.jboss.invocation.unified.marshall.InvocationUnMarshaller]]>
+</attribute></programlisting>
<para>If were using config element to declare the invoker, will need to
add an attribute for each and include the isParam attribute set to true.
For example:</para>
- <programlisting>
- <invoker transport="socket">
- <attribute name="dataType" isParam="true">invocation</attribute>
- <attribute name="marshaller" isParam="true">
- org.jboss.invocation.unified.marshall.InvocationMarshaller
- </attribute>
- <attribute name="unmarshaller" isParam="true">
- org.jboss.invocation.unified.marshall.InvocationUnMarshaller
- </attribute>
- </invoker>
- </programlisting>
+ <programlisting><invoker transport="socket">
+ <attribute name="dataType" isParam="true">invocation</attribute>
+ <attribute name="marshaller" isParam="true">
+ org.jboss.invocation.unified.marshall.InvocationMarshaller
+ </attribute>
+ <attribute name="unmarshaller" isParam="true">
+ org.jboss.invocation.unified.marshall.InvocationUnMarshaller
+ </attribute>
+</invoker></programlisting>
<para>This configuration is fine if the classes are present within the
client's classpath. If they are not, can provide configuration for
@@ -2714,18 +2653,16 @@
this, can use the parameter 'loaderport' with the value of the port you
would like your marshal loader to run on. For example:</para>
- <programlisting>
- <invoker transport="socket">
- <attribute name="dataType" isParam="true">invocation</attribute>
- <attribute name="marshaller" isParam="true">
- org.jboss.invocation.unified.marshall.InvocationMarshaller
- </attribute>
- <attribute name="unmarshaller" isParam="true">
- org.jboss.invocation.unified.marshall.InvocationUnMarshaller
- </attribute>
- <attribute name="loaderport" isParam="true">5401</attribute>
- </invoker>
- </programlisting>
+ <programlisting><invoker transport="socket">
+ <attribute name="dataType" isParam="true">invocation</attribute>
+ <attribute name="marshaller" isParam="true">
+ org.jboss.invocation.unified.marshall.InvocationMarshaller
+ </attribute>
+ <attribute name="unmarshaller" isParam="true">
+ org.jboss.invocation.unified.marshall.InvocationUnMarshaller
+ </attribute>
+ <attribute name="loaderport" isParam="true">5401</attribute>
+</invoker></programlisting>
<para>When this parameter is supplied, the Connector will recognize this
at startup and create a marshal loader connector automatically, which will
@@ -2794,9 +2731,7 @@
creation of a callback connection results in a server side call to the
</para>
- <programlisting>
- public void addListener(InvokerCallbackHandler callbackHandler);
- </programlisting>
+ <programlisting>public void addListener(InvokerCallbackHandler callbackHandler);</programlisting>
<para>
method of the application's
@@ -2867,9 +2802,7 @@
One way to transmit a callback is by invoking the
</para>
- <programlisting>
- public void handleCallback(Callback callback) throws HandleCallbackException;
- </programlisting>
+ <programlisting>public void handleCallback(Callback callback) throws HandleCallbackException;</programlisting>
<para>
method of <classname>InvokerCallbackHandler</classname>. The
@@ -2890,11 +2823,10 @@
<methodname>handleCallbackOneway()</methodname> methods
</para>
- <programlisting>
- public void handleCallbackOneway(Callback callback) throws HandleCallbackException;
+ <programlisting>public void handleCallbackOneway(Callback callback) throws HandleCallbackException;
- public void handleCallbackOneway(Callback callback, boolean serverSide)) throws HandleCallbackException;
- </programlisting>
+public void handleCallbackOneway(Callback callback, boolean serverSide)
+ throws HandleCallbackException;</programlisting>
<para>
of <classname>AsynchInvokerCallbackHandler</classname>. (Note that all
@@ -2909,9 +2841,7 @@
<code>clientSide</code> parameter in the
</para>
- <programlisting>
- public void invokeOneway(final Object param, final Map sendPayload, boolean clientSide) throws Throwable;
- </programlisting>
+ <programlisting>public void invokeOneway(Object param, Map sendPayload, boolean clientSide) throws Throwable;</programlisting>
<para>
method of <classname>org.jboss.remoting.Client</classname>. That is,
@@ -3047,17 +2977,16 @@
<classname>org.jboss.remoting.callback.CallbackListener</classname> interface
</para>
- <programlisting>
- public interface CallbackListener
- {
- /**
- * @param callbackHandler InvokerCallbackHandler that handled this callback
- * @param callbackId id of callback being acknowledged
- * @param response either (1) response sent with acknowledgement or (2) null
- */
- void acknowledgeCallback(InvokerCallbackHandler callbackHandler, Object callbackId, Object response);
- }
- </programlisting>
+ <programlisting>public interface CallbackListener
+{
+ /**
+ * @param callbackHandler InvokerCallbackHandler that handled this callback
+ * @param callbackId id of callback being acknowledged
+ * @param response either (1) response sent with acknowledgement or (2) null
+ */
+ void acknowledgeCallback(
+ InvokerCallbackHandler callbackHandler, Object callbackId, Object response);
+}</programlisting>
<para>
may be registered to receive an acknowledgement for a particular
@@ -3098,15 +3027,17 @@
<methodname>acknowledgeCallbacks()</methodname> methods
</para>
- <programlisting>
- public int acknowledgeCallback(InvokerCallbackHandler callbackHandler, Callback callback) throws Throwable;
+ <programlisting>public int acknowledgeCallback(
+ InvokerCallbackHandler callbackHandler, Callback callback) throws Throwable;
- public int acknowledgeCallback(InvokerCallbackHandler callbackHandler, Callback callback, Object response) throws Throwable;
+public int acknowledgeCallback(
+ InvokerCallbackHandler callbackHandler, Callback callback, Object response) throws Throwable;
- public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler, List callbacks) throws Throwable;
+public int acknowledgeCallbacks(
+ InvokerCallbackHandler callbackHandler, List callbacks) throws Throwable;
- public int acknowledgeCallbacks(InvokerCallbackHandler callbackHandler, List callbacks, List responses) throws Throwable;
- </programlisting>
+public int acknowledgeCallbacks(
+ InvokerCallbackHandler callbackHandler, List callbacks, List responses) throws Throwable;</programlisting>
<para>
of the <classname>Client</classname> class. In each case the
@@ -3169,13 +3100,15 @@
<classname>Client</classname> class:
</para>
- <programlisting>
- public void addListener(InvokerCallbackHandler) throws Throwable;
+ <programlisting>public void addListener(
+ InvokerCallbackHandler) throws Throwable;
- public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws Throwable;
+public void addListener(
+ InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws Throwable;
- public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator, Object callbackHandlerObject) throws Throwable;
- </programlisting>
+public void addListener(
+ InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator,
+ Object callbackHandlerObject) throws Throwable;</programlisting>
<para>
where, in the latter two cases, the <code>clientLocator</code> parameter is set to null.
@@ -3185,9 +3118,7 @@
The callbacks stored for a pull callback connection may be retrieved by calling the
</para>
- <programlisting>
- public List getCallbacks(InvokerCallbackHandler callbackHandler) throws Throwable
- </programlisting>
+ <programlisting>public List getCallbacks(InvokerCallbackHandler callbackHandler) throws Throwable</programlisting>
<para>
method of the <classname>Client</classname> class. Note that for pull
@@ -3217,9 +3148,8 @@
or <classname>ServerInvoker.NONBLOCKING</classname> (actual value
"nonblocking") in the metadata map passed to</para>
- <programlisting>
- public List getCallbacks(InvokerCallbackHandler callbackHandler, Map metadata) throws Throwable;
- </programlisting>
+ <programlisting>public List getCallbacks(
+ InvokerCallbackHandler callbackHandler, Map metadata) throws Throwable;</programlisting>
<para>in <classname>org.jboss.remoting.Client</classname>. The default
value is <code>ServerInvoker.NONBLOCKING</code>. The blocking timeout value
@@ -3303,11 +3233,12 @@
<methodname>addListener()</methodname>:
</para>
- <programlisting>
- public void addListener(InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws Throwable;
+ <programlisting>public void addListener(
+ InvokerCallbackHandler callbackHandler, InvokerLocator clientLocator) throws Throwable;
- public void addListener(InvokerCallbackHandler callbackHandler,InvokerLocator clientLocator, Object callbackHandlerObject) throws Throwable;
- </programlisting>
+public void addListener(
+ InvokerCallbackHandler callbackHandler,InvokerLocator clientLocator,
+ Object callbackHandlerObject) throws Throwable;</programlisting>
<para>
Because there is a <classname>Connector</classname>, explicit configuration always results in true push callbacks.
@@ -3320,13 +3251,16 @@
<methodname>addListener()</methodname> is used:
</para>
- <programlisting>
- public void addListener(InvokerCallbackHandler callbackhandler, Map metadata) throws Throwable;
+ <programlisting>public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata) throws Throwable;
- public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject) throws Throwable;
+public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject) throws Throwable;
- public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject, boolean serverToClient) throws Throwable;
- </programlisting>
+public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject, boolean serverToClient) throws Throwable;</programlisting>
<para>
Note that the latter three methods are distinguished from the first
@@ -3377,11 +3311,9 @@
methods. For example,
</para>
- <programlisting>
- InvokerCallbackHandler callbackHandler = new SampleCallbackHandler();
- client.addListener(callbackHandler, new HashMap(), null, true);
- client.addListener(callbackHandler, new HashMap(), null, true);
- </programlisting>
+ <programlisting>InvokerCallbackHandler callbackHandler = new SampleCallbackHandler();
+client.addListener(callbackHandler, new HashMap(), null, true);
+client.addListener(callbackHandler, new HashMap(), null, true);</programlisting>
<para>
would result in a set of two callback
@@ -3391,23 +3323,19 @@
<classname>Client</classname> method
</para>
- <programlisting>
- public Set getCallbackConnectors(InvokerCallbackHandler callbackHandler);
- </programlisting>
+ <programlisting>public Set getCallbackConnectors(InvokerCallbackHandler callbackHandler);</programlisting>
<para>
A callback <classname>Connector</classname> could be reused as in the
following code:
</para>
- <programlisting>
- InvokerCallbackHandler callbackHandler1 = new SampleCallbackHandler();
- client.addListener(callbackHandler1, new HashMap(), null, true);
- Set callbackConnectors = client.getCallbackConnectors(callbackHandler1);
- Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
- InvokerCallbackHandler callbackHandler2 = new SampleCallbackHandler();
- client.addListener(callbackHandler2, callbackConnector.getLocator());
- </programlisting>
+ <programlisting>InvokerCallbackHandler callbackHandler1 = new SampleCallbackHandler();
+client.addListener(callbackHandler1, new HashMap(), null, true);
+Set callbackConnectors = client.getCallbackConnectors(callbackHandler1);
+Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
+InvokerCallbackHandler callbackHandler2 = new SampleCallbackHandler();
+client.addListener(callbackHandler2, callbackConnector.getLocator());</programlisting>
<para>
which would result in the implicitly created callback
@@ -3417,13 +3345,11 @@
the following:
</para>
- <programlisting>
- InvokerCallbackHandler callbackHandler1 = new SampleCallbackHandler();
- client.addListener(callbackHandler1, new HashMap(), null, true);
- Set callbackConnectors = client.getCallbackConnectors(callbackHandler1);
- Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
- client.addListener(callbackHandler1, callbackConnector.getLocator());
- </programlisting>
+ <programlisting>InvokerCallbackHandler callbackHandler1 = new SampleCallbackHandler();
+client.addListener(callbackHandler1, new HashMap(), null, true);
+Set callbackConnectors = client.getCallbackConnectors(callbackHandler1);
+Connector callbackConnector = (Connector) callbackConnectors.iterator().next();
+client.addListener(callbackHandler1, callbackConnector.getLocator());</programlisting>
<para>
then only one callback connection would be created, because a single
@@ -3571,9 +3497,7 @@
Callback connections are torn down through a call to the method
</para>
- <programlisting>
- public void removeListener(InvokerCallbackHandler callbackHandler) throws Throwable;
- </programlisting>
+ <programlisting>public void removeListener(InvokerCallbackHandler callbackHandler) throws Throwable;</programlisting>
<para>
in the <classname>org.jboss.remoting.Client</classname> class. A
@@ -3648,90 +3572,87 @@
objects written to disk. The default value is 'ser'.</para>
<bridgehead>Sample service configuration</bridgehead>
-
- <para>Socket transport with callback store specified by class name and
+<para>Socket transport with callback store specified by class name and
memory ceiling set to 30%:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="socket">
- <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
- <attribute name="callbackMemCeiling">30</attribute>
- </invoker>
- <handlers>
- <handler subsystem="test">
- org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
- </handler>
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="socket">
+ <attribute name="callbackStore">
+ org.jboss.remoting.callback.CallbackStore
+ </attribute>
+ <attribute name="callbackMemCeiling">30</attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="test">
+ org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
<para>Socket transport with callback store specified by MBean ObjectName
and declaration of CallbackStore as service:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.callback.CallbackStore"
- name="jboss.remoting:service=CallbackStore,type=Serializable"
- display-name="Persisted Callback Store">
+ <programlisting><mbean code="org.jboss.remoting.callback.CallbackStore"
+ name="jboss.remoting:service=CallbackStore,type=Serializable"
+ display-name="Persisted Callback Store">
- <!-- the directory to store the persisted callbacks into -->
- <attribute name="StoreFilePath">callback_store</attribute>
- <!-- the file suffix to use for each callback persisted to disk -->
- <attribute name="StoreFileSuffix">cbk</attribute>
- </mbean>
+ <!-- the directory to store the persisted callbacks into -->
+ <attribute name="StoreFilePath">callback_store</attribute>
+ <!-- the file suffix to use for each callback persisted to disk -->
+ <attribute name="StoreFileSuffix">cbk</attribute>
+</mbean>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+<mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="socket">
- <attribute name="callbackStore">
- jboss.remoting:service=CallbackStore,type=Serializable
- </attribute>
- </invoker>
- <handlers>
- <handler subsystem="test">
- org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
- </handler>
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="socket">
+ <attribute name="callbackStore">
+ jboss.remoting:service=CallbackStore,type=Serializable
+ </attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="test">
+ org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
<para>Socket transport with callback store specified by class name and
the callback store's file path and file suffix defined:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="socket">
- <attribute name="callbackStore">org.jboss.remoting.callback.CallbackStore</attribute>
- <attribute name="StoreFilePath">callback</attribute>
- <attribute name="StoreFileSuffix">cst</attribute>
- </invoker>
- <handlers>
- <handler subsystem="test">
- org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
- </handler>
- </handlers>
- </config>
- </attribute>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="socket">
+ <attribute name="callbackStore">
+ org.jboss.remoting.callback.CallbackStore
+ </attribute>
+ <attribute name="StoreFilePath">callback</attribute>
+ <attribute name="StoreFileSuffix">cst</attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="test">
+ org.jboss.remoting.callback.pull.memory.CallbackInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+</mbean></programlisting>
</section>
<section>
@@ -3864,20 +3785,19 @@
<code><serverSocketFactory></code> attribute to the name of
a <classname>ServerSocketFactoryMBean</classname> and pass the
document to <methodname>Connector.setConfiguration()</methodname>.
- For example: <programlisting>
- StringBuffer buf = new StringBuffer();
- buf.append("<?xml version=\"1.0\"?>\n");
- buf.append("<config>");
- buf.append(" <invoker transport=\"sslsocket\">");
- buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
- buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
- buf.append(" <attribute name=\"serverSocketFactory\">" + socketFactoryObjName + "</attribute>");
- buf.append(" </invoker>");
- buf.append("</config>");
- ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
- Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
- connector.setConfiguration(xml.getDocumentElement());
- </programlisting></para>
+ For example: <programlisting>StringBuffer buf = new StringBuffer();
+buf.append("<?xml version=\"1.0\"?>\n");
+buf.append("<config>");
+buf.append(" <invoker transport=\"sslsocket\">");
+buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
+buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
+buf.append(" <attribute name=\"serverSocketFactory\">" + socketFactoryObjName + "</attribute>");
+buf.append(" </invoker>");
+buf.append("</config>");
+
+ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
+Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
+connector.setConfiguration(xml.getDocumentElement());</programlisting></para>
</listitem>
<listitem>
@@ -4030,20 +3950,19 @@
<code><socketFactory></code> attribute to the class name of
a <classname>SocketFactory</classname> and pass the document to
<methodname>Connector.setConfiguration()</methodname>. For
- example: <programlisting>
- StringBuffer buf = new StringBuffer();
- buf.append("<?xml version=\"1.0\"?>\n");
- buf.append("<config>");
- buf.append(" <invoker transport=\"sslsocket\">");
- buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
- buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
- buf.append(" <attribute name=\"socketFactory\">" + socketFactoryClassname + "</attribute>");
- buf.append(" </invoker>");
- buf.append("</config>");
- ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
- Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
- connector.setConfiguration(xml.getDocumentElement());
- </programlisting> The
+ example: <programlisting>StringBuffer buf = new StringBuffer();
+buf.append("<?xml version=\"1.0\"?>\n");
+buf.append("<config>");
+buf.append(" <invoker transport=\"sslsocket\">");
+buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
+buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
+buf.append(" <attribute name=\"socketFactory\">" + socketFactoryClassname + "</attribute>");
+buf.append(" </invoker>");
+buf.append("</config>");
+
+ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
+Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
+connector.setConfiguration(xml.getDocumentElement());</programlisting> The
<classname>SocketFactory</classname> class must have a default
constructor, which will be used to create a
<classname>SocketFactory</classname>.</para>
@@ -4152,20 +4071,19 @@
<code><serverSocketFactory></code> attribute to the class
name of a <classname>ServerSocketFactory</classname> and pass the
document to <methodname>Connector.setConfiguration()</methodname>.
- For example: <programlisting>
- StringBuffer buf = new StringBuffer();
- buf.append("<?xml version=\"1.0\"?>\n");
- buf.append("<config>");
- buf.append(" <invoker transport=\"sslsocket\">");
- buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
- buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
- buf.append(" <attribute name=\"serverSocketFactory\">" + serverSocketFactoryClassname + "</attribute>");
- buf.append(" </invoker>");
- buf.append("</config>");
- ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
- Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
- connector.setConfiguration(xml.getDocumentElement());
- </programlisting> The
+ For example: <programlisting>StringBuffer buf = new StringBuffer();
+buf.append("<?xml version=\"1.0\"?>\n");
+buf.append("<config>");
+buf.append(" <invoker transport=\"sslsocket\">");
+buf.append(" <attribute name=\"serverBindAddress\">" + getHostName() + "</attribute>");
+buf.append(" <attribute name=\"serverBindPort\">" + freeport + "</attribute>");
+buf.append(" <attribute name=\"serverSocketFactory\">" + serverSocketFactoryClassname + "</attribute>");
+buf.append(" </invoker>");
+buf.append("</config>");
+
+ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes());
+Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais);
+connector.setConfiguration(xml.getDocumentElement());</programlisting> The
<classname>ServerSocketFactory</classname> class must have a
default constructor, which will be used to create a
<classname>ServerSocketFactory</classname>.</para>
@@ -4368,19 +4286,18 @@
<para>An example of the first case would be:</para>
- <programlisting>
- <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=Socket"
- display-name="Socket transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=Socket"
+ display-name="Socket transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="sslsocket">
- <attribute name="serverSocketFactory">
- jboss.remoting:service=ServerSocketFactory,type=SSL
- </attribute>
- <attribute name="numAcceptThreads">1</attribute>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="sslsocket">
+ <attribute name="serverSocketFactory">
+ jboss.remoting:service=ServerSocketFactory,type=SSL
+ </attribute>
+ <attribute name="numAcceptThreads">1</attribute>
+ ...</programlisting>
<para>The <code>serverSocketFactory</code> attribute is processed as
follows:</para>
@@ -4431,9 +4348,7 @@
is accessible by way of its <classname>ObjectName</classname>, which has
the form</para>
- <programlisting>
- jboss.remoting:service=invoker,transport=socket,host=www.jboss.com,port=8765
- </programlisting>
+ <programlisting>jboss.remoting:service=invoker,transport=socket,host=www.jboss.com,port=8765</programlisting>
<para>for example, followed by additional parameter=value pairs. (See
the jmx-console for a running instance of JBossAS at
@@ -4442,13 +4357,11 @@
in a <code>*-service.xml</code> file to be dependent on the server
invoker MBean, e.g.</para>
- <programlisting>
- <mbean code="org.jboss.BlueMonkey" name="jboss.remoting:bluemonkey,name=diamond">
- <depends optional-attribute-name="serverInvoker">
- jboss.remoting:service=invoker,transport=socket,host=www.jboss.com,port=8765
- </depends>
- </mbean>
- </programlisting>
+ <programlisting><mbean code="org.jboss.BlueMonkey" name="jboss.remoting:bluemonkey,name=diamond">
+ <depends optional-attribute-name="serverInvoker">
+ jboss.remoting:service=invoker,transport=socket,host=www.jboss.com,port=8765
+ </depends>
+</mbean></programlisting>
<para>then <methodname>org.jboss.BlueMonkey.create()</methodname> will
have access to the designated server invoker after the invoker has been
@@ -4471,19 +4384,17 @@
<code>org.jboss.remoting.socketfactory</code> package:
</para>
- <programlisting>
- public interface SocketCreationListener
- {
- /**
- * Called when a socket has been created.
- *
- * @param socket socket that has been created
- * @param source SocketFactory or ServerSocket that created the socket
- * @throws IOException
- */
- void socketCreated(Socket socket, Object source) throws IOException;
- }
- </programlisting>
+ <programlisting>public interface SocketCreationListener
+{
+ /**
+ * Called when a socket has been created.
+ *
+ * @param socket socket that has been created
+ * @param source SocketFactory or ServerSocket that created the socket
+ * @throws IOException
+ */
+ void socketCreated(Socket socket, Object source) throws IOException;
+}</programlisting>
<para>
Socket creation listeners can be registered to be informed every time a
@@ -4497,19 +4408,17 @@
<classname>org.jboss.remoting.Remoting</classname>:
</para>
- <programlisting>
- /**
- * Key for the configuration map passed to a Client or Connector to indicate
- * a socket creation listener for sockets created by a SocketFactory.
- */
- public static final String SOCKET_CREATION_CLIENT_LISTENER = "socketCreationClientListener";
+ <programlisting>/**
+ * Key for the configuration map passed to a Client or Connector to indicate
+ * a socket creation listener for sockets created by a SocketFactory.
+ */
+public static final String SOCKET_CREATION_CLIENT_LISTENER = "socketCreationClientListener";
- /**
- * Key for the configuration map passed to a Client or Connector to indicate
- * a socket creation listener for sockets created by a ServerSocket.
- */
- public static final String SOCKET_CREATION_SERVER_LISTENER = "socketCreationServerListener";
- </programlisting>
+/**
+ * Key for the configuration map passed to a Client or Connector to indicate
+ * a socket creation listener for sockets created by a ServerSocket.
+ */
+public static final String SOCKET_CREATION_SERVER_LISTENER = "socketCreationServerListener";</programlisting>
<para>
The value associated with either of these keys can be an actual object,
@@ -4580,27 +4489,33 @@
<para>An example of setting up https via service.xml configuration would
be:</para>
- <programlisting> <mbean code="org.jboss.remoting.transport.Connector"
- name="jboss.remoting:service=Connector,transport=HTTPS"
- display-name="HTTPS transport Connector">
+ <programlisting><mbean code="org.jboss.remoting.transport.Connector"
+ name="jboss.remoting:service=Connector,transport=HTTPS"
+ display-name="HTTPS transport Connector">
- <attribute name="Configuration">
- <config>
- <invoker transport="https">
- <attribute name="serverSocketFactory">jboss.remoting:service=ServerSocketFactory,type=SSL</attribute>
- <attribute name="SSLImplementation">org.jboss.remoting.transport.coyote.ssl.RemotingSSLImplementation</attribute>
- <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
- <attribute name="serverBindPort">6669</attribute>
- </invoker>
- <handlers>
- <handler subsystem="mock">org.jboss.test.remoting.transport.mock.MockServerInvocationHandler</handler>
- </handlers>
- </config>
- </attribute>
- <!-- This depends is included because need to make sure this mbean is running before configure invoker. -->
- <depends>jboss.remoting:service=ServerSocketFactory,type=SSL</depends>
- </mbean>
- </programlisting>
+ <attribute name="Configuration">
+ <config>
+ <invoker transport="https">
+ <attribute name="serverSocketFactory">
+ jboss.remoting:service=ServerSocketFactory,type=SSL
+ </attribute>
+ <attribute name="SSLImplementation">
+ org.jboss.remoting.transport.coyote.ssl.RemotingSSLImplementation
+ </attribute>
+ <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
+ <attribute name="serverBindPort">6669</attribute>
+ </invoker>
+ <handlers>
+ <handler subsystem="mock">
+ org.jboss.test.remoting.transport.mock.MockServerInvocationHandler
+ </handler>
+ </handlers>
+ </config>
+ </attribute>
+ <!-- This depends is included because need to make sure
+ this mbean is running before configure invoker. -->
+ <depends>jboss.remoting:service=ServerSocketFactory,type=SSL</depends>
+</mbean></programlisting>
<para>See section <xref
linkend="section-SSLServerSocketFactoryService" /> below for a
@@ -4655,9 +4570,7 @@
<para>Also, the sslsocket server invoker inherits from the socket server
invoker a method with signature</para>
- <programlisting>
- public void setNewServerSocketFactory(ServerSocketFactory serverSocketFactory)
- </programlisting>
+ <programlisting>public void setNewServerSocketFactory(ServerSocketFactory serverSocketFactory)</programlisting>
<para>which supports dynamic replacement of server socket factories. The
principal motivation for this facility is to be able to swap in a new
@@ -5051,20 +4964,18 @@
<classname>SSLSocketBuilder</classname> and using it to create a custom
<classname>SSLSocketFactory</classname>:</para>
- <programlisting>
- protected SSLSocketFactory getSocketFactory() throws Exception
- {
- HashMap config = new HashMap();
- config.put(SSLSocketBuilder.REMOTING_KEY_STORE_TYPE, "JKS");
- String keyStoreFilePath = getKeystoreFilePath();
- config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, keyStoreFilePath);
- config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "unit-tests-server");
- config.put(SSLSocketBuilder.REMOTING_SSL_PROTOCOL, "SSL");
- SSLSocketBuilder builder = new SSLSocketBuilder(config);
- builder.setUseSSLSocketFactory(false);
- return builder.createSSLSocketFactory();
- }
- </programlisting>
+ <programlisting>protected SSLSocketFactory getSocketFactory() throws Exception
+{
+ HashMap config = new HashMap();
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_TYPE, "JKS");
+ String keyStoreFilePath = getKeystoreFilePath();
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, keyStoreFilePath);
+ config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "unit-tests-server");
+ config.put(SSLSocketBuilder.REMOTING_SSL_PROTOCOL, "SSL");
+ SSLSocketBuilder builder = new SSLSocketBuilder(config);
+ builder.setUseSSLSocketFactory(false);
+ return builder.createSSLSocketFactory();
+}</programlisting>
<para>More examples of configuring
<classname>SSLSocketBuilder</classname> can be found in the class
@@ -5074,43 +4985,41 @@
<para>The following is an example of configuring
<classname>SSLSocketBuilder</classname> in a *-service.xml file:</para>
- <programlisting>
- <!-- This service is used to build the SSL Server socket factory -->
- <!-- This will be where all the store/trust information will be set. -->
- <!-- If do not need to make any custom configurations, no extra attributes -->
- <!-- need to be set for the SSLSocketBuilder and just need to set the -->
- <!-- javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword system properties. -->
- <!-- This can be done by just adding something like the following to the run -->
- <!-- script for JBoss -->
- <!-- (this one is for run.bat): -->
- <!-- set JAVA_OPTS=-Djavax.net.ssl.keyStore=.keystore -->
- <!-- -Djavax.net.ssl.keyStorePassword=opensource %JAVA_OPTS% -->
- <!-- Otherwise, if want to customize the attributes for SSLSocketBuilder, -->
- <!-- will need to uncomment them below. -->
- <mbean code="org.jboss.remoting.security.SSLSocketBuilder"
- name="jboss.remoting:service=SocketBuilder,type=SSL"
- display-name="SSL Server Socket Factory Builder">
- <!-- IMPORTANT - If making ANY customizations, this MUST be set to false. -->
- <!-- Otherwise, will used default settings and the following attributes will be ignored. -->
- <attribute name="UseSSLServerSocketFactory">false</attribute>
- <!-- This is the url string to the key store to use -->
- <attribute name="KeyStoreURL">.keystore</attribute>
- <!-- The password for the key store -->
- <attribute name="KeyStorePassword">opensource</attribute>
- <!-- The password for the keys (will use KeystorePassword if this is not set explicitly. -->
- <attribute name="KeyPassword">opensource</attribute>
- <!-- The protocol for the SSLContext. Default is TLS. -->
- <attribute name="SecureSocketProtocol">TLS</attribute>
- <!-- The algorithm for the key manager factory. Default is SunX509. -->
- <attribute name="KeyManagementAlgorithm">SunX509</attribute>
- <!-- The type to be used for the key store. -->
- <!-- Defaults to JKS. Some acceptable values are JKS (Java Keystore - Sun's keystore format), -->
- <!-- JCEKS (Java Cryptography Extension keystore - More secure version of JKS), and -->
- <!-- PKCS12 (Public-Key Cryptography Standards #12 keystore - RSA's Personal Information Exchange Syntax Standard). -->
- <!-- These are not case sensitive. -->
- <attribute name="KeyStoreType">JKS</attribute>
- </mbean>
- </programlisting>
+ <programlisting><!-- This service is used to build the SSL Server socket factory -->
+<!-- This will be where all the store/trust information will be set. -->
+<!-- If do not need to make any custom configurations, no extra attributes -->
+<!-- need to be set for the SSLSocketBuilder and just need to set the -->
+<!-- javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword system properties. -->
+<!-- This can be done by just adding something like the following to the run -->
+<!-- script for JBoss -->
+<!-- (this one is for run.bat): -->
+<!-- set JAVA_OPTS=-Djavax.net.ssl.keyStore=.keystore -->
+<!-- -Djavax.net.ssl.keyStorePassword=opensource %JAVA_OPTS% -->
+<!-- Otherwise, if want to customize the attributes for SSLSocketBuilder, -->
+<!-- will need to uncomment them below. -->
+<mbean code="org.jboss.remoting.security.SSLSocketBuilder"
+ name="jboss.remoting:service=SocketBuilder,type=SSL"
+ display-name="SSL Server Socket Factory Builder">
+ <!-- IMPORTANT - If making ANY customizations, this MUST be set to false. -->
+ <!-- Otherwise, will used default settings and the following attributes will be ignored. -->
+ <attribute name="UseSSLServerSocketFactory">false</attribute>
+ <!-- This is the url string to the key store to use -->
+ <attribute name="KeyStoreURL">.keystore</attribute>
+ <!-- The password for the key store -->
+ <attribute name="KeyStorePassword">opensource</attribute>
+ <!-- The password for the keys (will use KeystorePassword if this is not set explicitly. -->
+ <attribute name="KeyPassword">opensource</attribute>
+ <!-- The protocol for the SSLContext. Default is TLS. -->
+ <attribute name="SecureSocketProtocol">TLS</attribute>
+ <!-- The algorithm for the key manager factory. Default is SunX509. -->
+ <attribute name="KeyManagementAlgorithm">SunX509</attribute>
+ <!-- The type to be used for the key store. -->
+ <!-- Defaults to JKS. Some acceptable values are JKS (Java Keystore - Sun's keystore format), -->
+ <!-- JCEKS (Java Cryptography Extension keystore - More secure version of JKS), and -->
+ <!-- PKCS12 (Public-Key Cryptography Standards #12 keystore - RSA's Personal Information Exchange Syntax Standard). -->
+ <!-- These are not case sensitive. -->
+ <attribute name="KeyStoreType">JKS</attribute>
+</mbean></programlisting>
<para>It is also possible to set the default socket factory to be used
when not using customized settings (meaning UseSSLSocketFactory property
@@ -5143,16 +5052,14 @@
<classname>SSLSocketBuilder</classname> MBean defined in the xml
fragment above:</para>
- <programlisting>
- <!-- This service provides the exact same API as the ServerSocketFactory, so -->
- <!-- can be set as an attribute of that type on any MBean requiring an ServerSocketFactory. -->
- <mbean code="org.jboss.remoting.security.SSLServerSocketFactoryService"
- name="jboss.remoting:service=ServerSocketFactory,type=SSL"
- display-name="SSL Server Socket Factory">
- <depends optional-attribute-name="SSLSocketBuilder"
- proxy-type="attribute">jboss.remoting:service=SocketBuilder,type=SSL</depends>
- </mbean>
- </programlisting>
+ <programlisting><!-- This service provides the exact same API as the ServerSocketFactory, so -->
+<!-- can be set as an attribute of that type on any MBean requiring an ServerSocketFactory. -->
+<mbean code="org.jboss.remoting.security.SSLServerSocketFactoryService"
+ name="jboss.remoting:service=ServerSocketFactory,type=SSL"
+ display-name="SSL Server Socket Factory">
+ <depends optional-attribute-name="SSLSocketBuilder"
+ proxy-type="attribute">jboss.remoting:service=SocketBuilder,type=SSL</depends>
+</mbean></programlisting>
</section>
<section>
@@ -5169,27 +5076,25 @@
<para>Generating key entry into keystore:</para>
- <programlisting>
- C:\tmp\ssl>keytool -genkey -alias remoting -keyalg RSA
- Enter keystore password: opensource
- What is your first and last name?
- [Unknown]: Tom Elrod
- What is the name of your organizational unit?
- [Unknown]: Development
- What is the name of your organization?
- [Unknown]: JBoss Inc
- What is the name of your City or Locality?
- [Unknown]: Atlanta
- What is the name of your State or Province?
- [Unknown]: GA
- What is the two-letter country code for this unit?
- [Unknown]: US
- Is CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US correct?
- [no]: yes
+ <programlisting>C:\tmp\ssl>keytool -genkey -alias remoting -keyalg RSA
+Enter keystore password: opensource
+What is your first and last name?
+[Unknown]: Tom Elrod
+What is the name of your organizational unit?
+[Unknown]: Development
+What is the name of your organization?
+[Unknown]: JBoss Inc
+What is the name of your City or Locality?
+[Unknown]: Atlanta
+What is the name of your State or Province?
+[Unknown]: GA
+What is the two-letter country code for this unit?
+[Unknown]: US
+Is CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US correct?
+[no]: yes
- Enter key password for <remoting>
- (RETURN if same as keystore password):
- </programlisting>
+Enter key password for <remoting>
+(RETURN if same as keystore password):</programlisting>
<para>Since did not specify the -keystore filename parameter, created
the keystore in $HOME/.keystore (or C:\Documents and
@@ -5197,27 +5102,23 @@
<para>Export the RSA certificate (without the private key)</para>
- <programlisting>
- C:\tmp\ssl>keytool -export -alias remoting -file remoting.cer
- Enter keystore password: opensource
- Certificate stored in file <remoting.cer>
- </programlisting>
+ <programlisting>C:\tmp\ssl>keytool -export -alias remoting -file remoting.cer
+Enter keystore password: opensource
+Certificate stored in file <remoting.cer></programlisting>
<para>Import the RSE certificate into a new truststore file.</para>
- <programlisting>
- C:\tmp\ssl>keytool -import -alias remoting -keystore .truststore -file remoting.cer
- Enter keystore password: opensource
- Owner: CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US
- Issuer: CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US
- Serial number: 426f1ee3
- Valid from: Wed Apr 27 01:10:59 EDT 2005 until: Tue Jul 26 01:10:59 EDT 2005
- Certificate fingerprints:
- MD5: CF:D0:A8:7D:20:49:30:67:44:03:98:5F:8E:01:4A:6A
- SHA1: C6:76:3B:6C:79:3B:8D:FD:FB:4F:33:3B:25:C9:01:9D:50:BF:9F:8A
- Trust this certificate? [no]: yes
- Certificate was added to keystore
- </programlisting>
+ <programlisting>C:\tmp\ssl>keytool -import -alias remoting -keystore .truststore -file remoting.cer
+Enter keystore password: opensource
+Owner: CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US
+Issuer: CN=Tom Elrod, OU=Development, O=JBoss Inc, L=Atlanta, ST=GA, C=US
+Serial number: 426f1ee3
+Valid from: Wed Apr 27 01:10:59 EDT 2005 until: Tue Jul 26 01:10:59 EDT 2005
+Certificate fingerprints:
+MD5: CF:D0:A8:7D:20:49:30:67:44:03:98:5F:8E:01:4A:6A
+SHA1: C6:76:3B:6C:79:3B:8D:FD:FB:4F:33:3B:25:C9:01:9D:50:BF:9F:8A
+Trust this certificate? [no]: yes
+Certificate was added to keystore</programlisting>
<para>Now have two files, .keystore for the server and .truststore for
the client.</para>
@@ -5228,7 +5129,8 @@
<para>Common errors when using server socket factory:</para>
- <programlisting>javax.net.ssl.SSLException: No available certificate corresponds to the SSL cipher suites which are enabled.</programlisting>
+ <programlisting>javax.net.ssl.SSLException: No available certificate corresponds to the SSL cipher suites
+ which are enabled.</programlisting>
<para>The 'javax.net.ssl.keyStore' system property has not been set and
are using the default SSLServerSocketFactory.</para>
@@ -5238,7 +5140,8 @@
<para>The 'javax.net.ssl.keyStorePassword' system property has not been
set and are using the default SSLServerSocketFactory.</para>
- <programlisting>java.io.IOException: Can not create SSL Server Socket Factory due to the url to the key store not being set.</programlisting>
+ <programlisting>java.io.IOException: Can not create SSL Server Socket Factory due to the url to the key store
+ not being set.</programlisting>
<para>The default SSLServerSocketFactory is NOT being used (so custom
configuration for the server socket factory) and the key store url has
@@ -5275,11 +5178,9 @@
invokers also have the getter/setter methods
</para>
- <programlisting>
- public int getTimeout();
-
- public void setTimeout(int timeout);
- </programlisting>
+ <programlisting>public int getTimeout();
+
+public void setTimeout(int timeout);</programlisting>
<para>
where the values are given in milliseconds. The default timeout value
@@ -5299,11 +5200,9 @@
the invocation's metadata map, using the key "timeout". For example,
</para>
- <programlisting>
- HashMap metadata = new HashMap();
- metadata.put("timeout", "2000");
- client.invoke("testInvocation", metadata);
- </programlisting>
+ <programlisting>HashMap metadata = new HashMap();
+metadata.put("timeout", "2000");
+client.invoke("testInvocation", metadata);</programlisting>
<para>
will allow approximately 2 seconds for this particular invocation, after
@@ -5386,9 +5285,7 @@
<classname>HTTPClientInvoker</classname> method
</para>
- <programlisting>
- public void setTimeoutThreadPool(org.jboss.util.threadpool.ThreadPool pool);
- </programlisting>
+ <programlisting>public void setTimeoutThreadPool(org.jboss.util.threadpool.ThreadPool pool);</programlisting>
<para>
where the <methodname>ThreadPool</methodname> interface is available
@@ -5470,9 +5367,7 @@
<classname>Client</classname> method
</para>
- <programlisting>
- public void setDisconnectTimeout(int disconnectTimeout);
- </programlisting>
+ <programlisting>public void setDisconnectTimeout(int disconnectTimeout);</programlisting>
<para>
to set the disconnect timeout value to a nonnegative value.
@@ -5525,30 +5420,28 @@
<code>java.net.ServerSocket.accept()</code> has been replaced by
org.jboss.remoting.utility.SecurityUtility.accept():</para>
- <programlisting>
- static public Socket accept(final ServerSocket ss) throws IOException
- {
- if (skipAccessControl)
- {
- return ss.accept();
- }
-
- try
- {
- return (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return ss.accept();
- }
- });
- }
- catch (PrivilegedActionException e)
- {
- throw (IOException) e.getCause();
- }
- }
- </programlisting>
+ <programlisting>static public Socket accept(final ServerSocket ss) throws IOException
+{
+ if (skipAccessControl)
+ {
+ return ss.accept();
+ }
+
+ try
+ {
+ return (Socket)AccessController.doPrivileged( new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return ss.accept();
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+}</programlisting>
<para>Note that the
<methodname>AccessController.doPrivileged()</methodname> call, with its
@@ -5578,12 +5471,10 @@
code and to give it all possible permissions in a file that looks
like</para>
- <programlisting>
- grant codeBase "file:${remoting.dir}/jboss-remoting.jar"
- {
- permission java.security.AllPermission;
- };
- </programlisting>
+ <programlisting>grant codeBase "file:${remoting.dir}/jboss-remoting.jar"
+{
+ permission java.security.AllPermission;
+};</programlisting>
<para>This file grants all permissions to any class loaded from
jboss-remoting.jar. Alternatively, a more precisely tailored set of
@@ -5801,8 +5692,8 @@
not have access to, could create a invoker locator such as:</para>
<programlisting>socket://myhost:6500/?datatype=test&loaderport=6501&
-marshaller=org.jboss.test.remoting.marshall.dynamic.remote.http.TestMarshaller&
-unmarshaller=org.jboss.test.remoting.marshall.dynamic.remote.http.TestUnMarshaller</programlisting>
+ marshaller=org.jboss.test.remoting.marshall.dynamic.remote.http.TestMarshaller&
+ unmarshaller=org.jboss.test.remoting.marshall.dynamic.remote.http.TestUnMarshaller</programlisting>
<para>When the client invoker begins to make an invocation, will try to
look up marshaller and unmarshaller based on type ('test' in this case)
@@ -5879,8 +5770,12 @@
<para>The following three configuration properties are only useful when
using one of the following Client methods:</para>
- <programlisting>public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject) throws Throwable
-public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject, boolean serverToClient) throws Throwable</programlisting>
+ <programlisting>public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject) throws Throwable
+public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject, boolean serverToClient) throws Throwable</programlisting>
<para><emphasis role="bold">CALLBACK_SERVER_PROTOCOL</emphasis> (actual
value is 'callbackServerProtocol') - key for the configuration when adding
@@ -6173,8 +6068,12 @@
configuration is only necessary when using one of the
following Client methods:</para>
- <programlisting>public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject) throws Throwable
-public void addListener(InvokerCallbackHandler callbackhandler, Map metadata, Object callbackHandlerObject, boolean serverToClient) throws Throwable</programlisting>
+ <programlisting>public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject) throws Throwable
+public void addListener(
+ InvokerCallbackHandler callbackhandler, Map metadata,
+ Object callbackHandlerObject, boolean serverToClient) throws Throwable</programlisting>
<para>The keys should be among the entries in the metadata Map passed. This
will also only apply when the underlying transport is uni-directional
@@ -6353,10 +6252,10 @@
org.jboss.remoting.ServerInvocationHandler implementation. For
example:</para>
- <programlisting> public Object invoke(InvocationRequest invocation) throws Throwable
- {
- Map headers = invocation.getRequestPayload();
-</programlisting>
+ <programlisting>public Object invoke(InvocationRequest invocation) throws Throwable
+{
+ Map headers = invocation.getRequestPayload();
+ ...</programlisting>
<para>where variable 'headers' will contain entries for the following
keys.</para>
@@ -6368,15 +6267,14 @@
org.jboss.remoting.ServerInvocationHandler implementation. For
example:</para>
- <programlisting> public Object invoke(InvocationRequest invocation) throws Throwable
+ <programlisting>public Object invoke(InvocationRequest invocation) throws Throwable
+{
+ Map headers = invocation.getRequestPayload();
+ String methodType = (String) headers.get(HTTPMetadataConstants.METHODTYPE);
+ if(methodType != null)
{
- Map headers = invocation.getRequestPayload();
- String methodType = (String) headers.get(HTTPMetadataConstants.METHODTYPE);
- if(methodType != null)
- {
- if(methodType.equals("GET"))
- ...
- </programlisting>
+ if(methodType.equals("GET"))
+ ...</programlisting>
<para><emphasis role="bold">PATH</emphasis> (actual value is 'Path') - key
for getting the path from the url request from the calling client. This
@@ -6385,12 +6283,11 @@
org.jboss.remoting.ServerInvocationHandler implementation. For
example:</para>
- <programlisting> public Object invoke(InvocationRequest invocation) throws Throwable
- {
- Map headers = invocation.getRequestPayload();
- String path = (String) headers.get(HTTPMetadataConstants.PATH);
- ...
- </programlisting>
+ <programlisting>public Object invoke(InvocationRequest invocation) throws Throwable
+{
+ Map headers = invocation.getRequestPayload();
+ String path = (String) headers.get(HTTPMetadataConstants.PATH);
+ ...</programlisting>
<para><emphasis role="bold">HTTPVERSION</emphasis> (actual value is
'HttpVersion') - key for getting the HTTP version from the calling client
@@ -6408,17 +6305,15 @@
<programlisting>Map metadata = new HashMap();
Object response = remotingClient.invoke(myPayloadObject, metadata);
-Integer responseCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
- </programlisting>
+Integer responseCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);</programlisting>
<para>Will be used as key to put the response code in the return payload
map from invocation handler. For example:</para>
- <programlisting> public Object invoke(InvocationRequest invocation) throws Throwable
- {
- Map responseHeaders = invocation.getReturnPayload();
- responseHeaders.put(HTTPMetadataConstants.RESPONSE_CODE, new Integer(202));
- </programlisting>
+ <programlisting>public Object invoke(InvocationRequest invocation) throws Throwable
+{
+ Map responseHeaders = invocation.getReturnPayload();
+ responseHeaders.put(HTTPMetadataConstants.RESPONSE_CODE, new Integer(202)); </programlisting>
<para><emphasis role="bold">RESPONSE_CODE_MESSAGE</emphasis> (actual value
is 'ResponseCodeMessage') - key for getting and setting the HTTP response
@@ -6428,17 +6323,17 @@
<programlisting>Map metadata = new HashMap();
Object response = remotingClient.invoke(myPayloadObject, metadata);
-String responseCodeMessage = (String) metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
-</programlisting>
+String responseCodeMessage = (String) metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);</programlisting>
<para>Will be used as key to put the response code message in the return
payload map from invocation handler. For example:</para>
- <programlisting> public Object invoke(InvocationRequest invocation) throws Throwable
- {
- Map responseHeaders = invocation.getReturnPayload();
- responseHeaders.put(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE, "Custom response code and message from remoting server");
- </programlisting>
+ <programlisting>public Object invoke(InvocationRequest invocation) throws Throwable
+{
+ Map responseHeaders = invocation.getReturnPayload();
+ responseHeaders.put(
+ HTTPMetadataConstants.RESPONSE_CODE_MESSAGE,
+ "Custom response code and message from remoting server");</programlisting>
<para><emphasis role="bold">RESPONSE_HEADERS</emphasis> (actual value is
'ResponseHeaders') - key for returning the value of
@@ -6446,12 +6341,10 @@
words, a map containing all of the response headers is stored in the
metadata map. For example,</para>
- <programlisting>
- Object payload = ... ;
- HashMap metadata = new HashMap();
- client.invoke(payload, metadata);
- Map responseHeaders = (Map) metadata.get(HTTPMetadataConstants.RESPONSE_HEADERS);
- </programlisting>
+ <programlisting>Object payload = ... ;
+HashMap metadata = new HashMap();
+client.invoke(payload, metadata);
+Map responseHeaders = (Map) metadata.get(HTTPMetadataConstants.RESPONSE_HEADERS);</programlisting>
<para><emphasis role="bold">NO_THROW_ON_ERROR</emphasis> (actual value is
'NoThrowOnError') - key indicating if http client invoker (for transports
@@ -6574,4 +6467,4 @@
</section>
</section>
-</chapter>
\ No newline at end of file
+</chapter>
16 years, 5 months
JBoss Remoting SVN: r4425 - remoting2/tags.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-07-22 02:38:28 -0400 (Tue, 22 Jul 2008)
New Revision: 4425
Added:
remoting2/tags/2.2.2-SP9/
Log:
Copied: remoting2/tags/2.2.2-SP9 (from rev 4424, remoting2/branches/2.2)
16 years, 5 months
JBoss Remoting SVN: r4424 - remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-07-21 18:37:40 -0400 (Mon, 21 Jul 2008)
New Revision: 4424
Modified:
remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java
Log:
Allow the marshaller list to exceed one buffer in length
Modified: remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java
===================================================================
--- remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java 2008-07-21 18:38:27 UTC (rev 4423)
+++ remoting3/trunk/protocol/basic/src/main/java/org/jboss/cx/remoting/protocol/basic/BasicHandler.java 2008-07-21 22:37:40 UTC (rev 4424)
@@ -41,6 +41,7 @@
import org.jboss.cx.remoting.spi.SpiUtils;
import org.jboss.cx.remoting.spi.AbstractAutoCloseable;
import static org.jboss.cx.remoting.util.CollectionUtil.concurrentMap;
+import static org.jboss.cx.remoting.util.CollectionUtil.arrayList;
import org.jboss.cx.remoting.util.CollectionUtil;
import static org.jboss.cx.remoting.protocol.basic.MessageType.REQUEST_ONEWAY;
import static org.jboss.cx.remoting.protocol.basic.MessageType.REQUEST;
@@ -126,13 +127,23 @@
if (isnew.getAndSet(false)) {
this.channel = channel;
}
- final ByteBuffer buffer = allocator.allocate();
+ final List<ByteBuffer> bufferList = arrayList();
+ ByteBuffer buffer = allocator.allocate();
buffer.put((byte) VERSION);
buffer.putInt(LOCAL_VERSION);
- writeUTFZ(buffer, CollectionUtil.join(",", localMarshallerList));
- buffer.flip();
+ String joinedList = CollectionUtil.join(",", localMarshallerList);
+ for (;;) {
+ int i = writeUTFZ(buffer, joinedList);
+ if (i == -1) {
+ break;
+ }
+ bufferList.add(flip(buffer));
+ joinedList = joinedList.substring(i);
+ buffer = allocator.allocate();
+ }
+ bufferList.add(flip(buffer));
try {
- registerWriter(channel, new SimpleWriteHandler(allocator, buffer));
+ registerWriter(channel, new SimpleWriteHandler(allocator, bufferList));
} catch (InterruptedException e) {
log.error("Interrupted while sending intial version message");
IoUtils.safeClose(channel);
16 years, 5 months