📄 ch13s131.html
字号:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Customizing the JRMPContainerInvoker Socket Factories</title><link rel="stylesheet" href="styles.css" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vimages/callouts/"><link rel="home" href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html" title="JBoss 3.0 Documentation"><link rel="up" href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html" title="Chapter 13. HOWTO"><link rel="previous" href="ch13s126.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s126.html" title="External JNDI Configuration and JNDI Viewing"><link rel="next" href="ch13s135.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s135.html" title="Configuring and Using JAXP 1.1 In JBoss"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table border="0" cellpadding="0" cellspacing="0" height="65"><tr height="65"><td rowspan="2"><img src="jboss.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/jboss.gif" border="0"></td><td rowspan="2" background="gbar.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/gbar.gif" width="100%" align="right" valign="top"><a href="index.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/index.html"><img src="doc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/doc.gif" border="0"></a><a href="ch13.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13.html"><img src="toc.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/toc.gif" border="0"></a><a href="ch13s126.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s126.html"><img src="prev.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/prev.gif" border="0"></a><a href="ch13s135.html" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s135.html"><img src="next.gif" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/next.gif" border="0"></a></td></tr><tr></tr></table><div class="section"><a name="d0e11749"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="d0e11749"></a>Customizing the JRMPContainerInvoker Socket Factories</h2></div></div><p>Author:<span class="author">Scott Stark</span>
<tt><<a href="mailto:Scott_Stark@displayscape.com">Scott_Stark@displayscape.com</a>></tt>
</p><div class="section"><a name="d0e11763"></a><div class="titlepage"><div><h3 class="title"><a name="d0e11763"></a>Introduction</h3></div></div><p>The RMI/JRMP based implementation of the org.jboss.ejb.ContainerInvoker
interface supports customization of the socket factory implementation using the
standard RMI java.rmi.server.RMIClientSocketFactory and java.rmi.server.RMIServerSocketFactory
interfaces. This HowTo describes the customization usage and demonstrates an example
custom factory from the 1.3 RMI<a href="javascript:if(confirm('http://java.sun.com/j2se/1.3/docs/guide/rmi/rmisocketfactory.doc.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://java.sun.com/j2se/1.3/docs/guide/rmi/rmisocketfactory.doc.html'" tppabs="http://java.sun.com/j2se/1.3/docs/guide/rmi/rmisocketfactory.doc.html" target="_top">The Custom Socket Factory Tutorial</a>
</p></div><div class="section"><a name="d0e11771"></a><div class="titlepage"><div><h3 class="title"><a name="d0e11771"></a>Configuring the ContainerInvoker</h3></div></div><p>One of the many items that can be customized about the JBoss container
configurations is the container invoker and its configuration. <a href="ch13s131.html#container_invoker_conf.dtd" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s131.html#container_invoker_conf.dtd" title="Figure 13.26. jboss.xml container-invoker-config elements">Figure 13.26</a> illustrates the jboss.xml
elements that are available for customizing the container-invoker element
when it is set to org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker</p><div class="figure"><p><a name="container_invoker_conf.dtd"></a><b>Figure 13.26. jboss.xml container-invoker-config elements</b></p><div class="mediaobjectco"><img src="container_configuration_dtd.jpg" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/container_configuration_dtd.jpg"><div class="calloutlist"><a name="d0e11790"></a><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><a name="d0e11791"></a><img src="1.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/1.png" alt="1" border="0"></td><td valign="top" align="left"><p>The Optimized element tells if the container invoker to bypass
RMI layer when the client is local (same VM as the server). This optimizes RMI calls.
Its value must be true or false.</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="d0e11794"></a><img src="2.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/2.png" alt="2" border="0"></td><td valign="top" align="left"><p>The RMIObjectPort element indicates what port the RMI objects
created by this container should listen on. Any number of objects
in the same VM can use the same port. However, objects in
different VMs cannot use the same port. You may set this value
to 0 to use anyonmous ports (that is, each object just picks a
free port to use). If you want to run jBoss more than once on
the same machine, you must either create separate configurations
with separate ports, or set all the configurations to use
anonymous port. The standard jBoss setting is "4444".
Its value must an integer (0, or a valid port number). Note that
normal user on a UNIX system cannot access privileged ports (less than 1024)</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="d0e11797"></a><img src="3.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/3.png" alt="3" border="0"></td><td valign="top" align="left"><p>The RMIClientSocketFactory element indicates the use of a custom
socket factory that should be used by RMI objects created by
this container. The combination of socket factory type and port
must be unique but more than one container can use the same
socket factory, port combination.
Its value must be the fully qualified name of the class that
implements the java.rmi.server.RMIClientSocketFactory interface,
and the class must be available to the JBoss class loader.
If this element is not specified the default VM client socket
factory will be used.</p></td></tr><tr><td width="5%" valign="top" align="left"><a name="d0e11800"></a><img src="4.png" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/4.png" alt="4" border="0"></td><td valign="top" align="left"><p>The RMIServerSocketFactory element indicates the use of a custom
socket factory that should be used by RMI objects created by
this container. The combination of socket factory type and port
must be unique but more than one container can use the same
socket factory, port combination.
Its value must be the fully qualified name of the class that
implements the java.rmi.server.RMIServerSocketFactory interface,
and the class must be available to the JBoss class loader.
If this element is not specified the default VM server socket
factory will be used.</p></td></tr></table></div></div></div><p>Custominzation of the ContainerInvoker sockets entails sepecifying the
classes that implement the java.rmi.server.RMIClientSocketFactory and
java.rmi.server.RMIServerSocketFactory interfaces. <a href="ch13s131.html#comp.sockets.conf" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s131.html#comp.sockets.conf" title="Figure 13.27. Sample container-invoker-conf Element">Figure 13.27</a>gives a sample container-invoker-conf element.</p><div class="figure"><p><a name="comp.sockets.conf"></a><b>Figure 13.27. Sample container-invoker-conf Element</b></p><div class="literallayout"><br>
<container-invoker-conf><br>
<Optimized>true</Optimized><br>
<RMIObjectPort>4445</RMIObjectPort><br>
<RMIClientSocketFactory>org.jboss.test.jrmp.ejb.CompressionClientSocketFactory</RMIClientSocketFactory><br>
<RMIServerSocketFactory>org.jboss.test.jrmp.ejb.CompressionServerSocketFactory</RMIServerSocketFactory><br>
</container-invoker-conf><br>
</div></div></div><div class="section"><a name="d0e11812"></a><div class="titlepage"><div><h3 class="title"><a name="d0e11812"></a>CompressionSocket Example</h3></div></div><p>The jbosstest cvs module contains a org.jboss.test.jrmp package in the
src/main directory which contains tests of custom socket configuration. One
example is the CompressionSocket example from the RMI custom socket tutorial.
The org.jboss.test.jrmp.test.TestCustomSockets class access a stateless session
bean using the compression custom sockets as well as a stateful session bean
using the default JRMP socket factories. The ejb-jar.xml and jboss.xml deployment
descriptors for the ejb jar are given in <a href="ch13s131.html#comp.ejb-jar.xml" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s131.html#comp.ejb-jar.xml" title="Figure 13.28. TestCustomSockets Example ejb-jar.xml Descriptor">Figure 13.28</a>and <a href="ch13s131.html#comp.jboss.xml" tppabs="http://www.huihoo.org/jboss/online_manual/3.0/ch13s131.html#comp.jboss.xml" title="Figure 13.29. TestCustomSockets Example jboss.xml Descriptor">Figure 13.29</a> See the jbosstest module code for the
complete details.</p><div class="figure"><p><a name="comp.ejb-jar.xml"></a><b>Figure 13.28. TestCustomSockets Example ejb-jar.xml Descriptor</b></p><div class="literallayout"><br>
<?xml version="1.0"?><br>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"<br>
"http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd"><br>
<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -