PooledInvoker

PooledInvoker - RMI/Socket

 

The org.jboss.invocation.pooled.server.PooledInvoker is an MBean service that provides RMI over a custom socket transport implementation of the Invoker interface. The PooledInvoker exports itself as an RMI server so that when it is used as the Invoker in a remote client, the PooledInvoker stub is sent to the client instead and invocations use the custom socket protocol.

 

The PooledInvoker MBean supports a number of attribute to configure the socket transport layer. Its configurable attributes are:

 

  • NumAcceptThreads: The number of threads that exist for accepting client connections. The default is 1.

  • MaxPoolSize: The number of server threads for processing client. The default is 300.

  • SocketTimeout: The socket timeout value passed to the Socket.setSoTimeout() method. The default is 60000.

  • ServerBindPort: The port used for the server socket. A value of 0 indicates that an anonymous port should be chosen.

  • ClientConnectAddress: The address that the client passes to the Socket(addr, port) constructor. This defaults to the server InetAddress.getLocalHost() value.

  • ClientConnectPort: The port that the client passes to the Socket(addr, port) constructor. The default is the port of the server listening socket.

  • ClientMaxPoolSize: The client side maximum number of threads. The default is 300.

  • Backlog: The backlog associated with the server accept socket. The default is 200.

  • EnableTcpNoDelay: A boolean flag indicating if client sockets will enable the TcpNoDelay flag on the socket. The default is false.

  • ServerBindAddress: The address on which the server binds its listening socket. The default is an empty value which indicates the server should be bound on all interfaces.

  • TransactionManagerService: The JMX ObjectName of the JTA transaction manager service.

  • ClientSocketFactoryName: the javax.net.SocketFactory implementation class name to use on the client

  • ServerSocketFactoryName: the javax.net.ServerSocketFactory implementation class name to use on the server. See ServerSocketFactory as well.

  • ServerSocketFactory : an instantiated javax.net.ServerSocketFactory implementation to use on the server. See the Example SSL Config below for a usage.

 

Example Config

   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
      name="jboss:service=invoker,type=pooled">
      <attribute name="NumAcceptThreads">1</attribute>
      <attribute name="MaxPoolSize">300</attribute>
      <attribute name="ClientMaxPoolSize">300</attribute>
      <attribute name="SocketTimeout">60000</attribute>
      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
      <attribute name="ServerBindPort">4445</attribute>
      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
      <attribute name="ClientConnectPort">0</attribute>
      <attribute name="EnableTcpNoDelay">false</attribute>

      <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
   </mbean>

 

Example SSL Config

<?xml version="1.0" encoding="UTF-8"?>

<server>

   <mbean code="org.jboss.security.plugins.JaasSecurityDomain"
      name="jboss.security:service=JaasSecurityDomain,domain=pooled-ssl">
      <constructor>
         <arg type="java.lang.String" value="pooled-ssl"></arg>
      </constructor>
      <attribute name="KeyStoreURL">resource:localhost.keystore</attribute>
      <attribute name="KeyStorePass">unit-tests-server</attribute>
      <attribute name="TrustStoreURL">resource:localhost.keystore</attribute>
      <attribute name="TrustStorePass">unit-tests-server</attribute>
      <attribute name="Salt">abcdefgh</attribute>
      <attribute name="IterationCount">13</attribute>
   </mbean>

   <mbean code="org.jboss.invocation.pooled.server.PooledInvoker"
      name="jboss:service=invoker,type=pooled,socketType=SSLSocketFactory,wantsClientAuth=true">
      <attribute name="NumAcceptThreads">1</attribute>
      <attribute name="MaxPoolSize">300</attribute>
      <attribute name="ClientMaxPoolSize">300</attribute>
      <attribute name="SocketTimeout">60000</attribute>
      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
      <attribute name="ServerBindPort">0</attribute>
      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
      <attribute name="ClientConnectPort">0</attribute>
      <attribute name="ClientRetryCount">1</attribute>
      <attribute name="EnableTcpNoDelay">false</attribute>

      <!-- Customized socket factory attributes -->
      <attribute name="ClientSocketFactoryName">org.jboss.security.ssl.ClientSocketFactory</attribute>
      <attribute name="ServerSocketFactory"
         attributeClass="org.jboss.security.ssl.DomainServerSocketFactory"
         serialDataType="javaBean">
        <property name="bindAddress">${jboss.bind.address}</property>
        <property name="securityDomain">java:/jaas/pooled-ssl</property>
        <property name="wantsClientAuth">true</property>
        <property name="needsClientAuth">true</property>
         <property name="CiperSuites">TLS_DHE_DSS_WITH_AES_128_CBC_SHA</property>
         <property name="Protocols">SSLv2Hello,SSLv3,TLSv1</property>
      </attribute>
   </mbean>

   <mbean code="org.jboss.security.auth.login.DynamicLoginConfig"
      name="jboss.security.tests:service=LoginConfig,policy=pooled-ssl">
      <attribute name="PolicyConfig" serialDataType="jbxb">
         <jaas:policy
            xsi:schemaLocation="urn:jboss:security-config:4.1 resource:security-config_4_1.xsd"
            xmlns:jaas="urn:jboss:security-config:4.1"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            >
            <jaas:application-policy name="pooled-ssl">
               <jaas:authentication>
                  <jaas:login-module code="org.jboss.security.auth.spi.BaseCertLoginModule"
                     flag = "required">
                     <jaas:module-option name="password-stacking">useFirstPass</jaas:module-option>
                     <jaas:module-option name="securityDomain">java:/jaas/pooled-ssl</jaas:module-option>
                  </jaas:login-module>
                  <jaas:login-module code="org.jboss.security.auth.spi.XMLLoginModule"
                     flag="required">
                     <jaas:module-option name="password-stacking">useFirstPass</jaas:module-option>
                     <jaas:module-option name="userInfo">
                        <ur:users
                           xsi:schemaLocation="urn:jboss:user-roles:1.0 resource:user-roles_1_0.xsd"
                           xmlns:ur="urn:jboss:user-roles:1.0">
                           <ur:user name="CN=unit-tests-client, OU=JBoss Inc., O=JBoss Inc., ST=Washington, C=US" password="">
                              <ur:role name="Echo"></ur:role>
                           </ur:user>
                        </ur:users>
                     </jaas:module-option>
                     <jaas:module-option name="unauthenticatedIdentity">guest</jaas:module-option>
                  </jaas:login-module>
               </jaas:authentication>
            </jaas:application-policy>
         </jaas:policy>         
      </attribute>
      <depends optional-attribute-name="LoginConfigService">
         jboss.security:service=XMLLoginConfig
      </depends>
      <depends optional-attribute-name="SecurityManagerService">
         jboss.security:service=JaasSecurityManager
      </depends>
   </mbean>

</server>

 

see also

 

  • PooledInvokerConfig