[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/samples/config/factories ...
Ron Sigal
ron_sigal at yahoo.com
Tue Aug 1 02:24:25 EDT 2006
User: rsigal
Date: 06/08/01 02:24:25
Modified: src/main/org/jboss/remoting/samples/config/factories
FactoryConfigSample.java
FactoryConfigSSLSample.java
Log:
JBREM-520: Moved config by setting invokers to front (reflecting highest priority), and changed some javadoc to reflect option numbers in master.xml.
Revision Changes Path
1.3 +45 -44 JBossRemoting/src/main/org/jboss/remoting/samples/config/factories/FactoryConfigSample.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FactoryConfigSample.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/samples/config/factories/FactoryConfigSample.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- FactoryConfigSample.java 24 Jul 2006 05:46:16 -0000 1.2
+++ FactoryConfigSample.java 1 Aug 2006 06:24:25 -0000 1.3
@@ -75,6 +75,7 @@
{
protected static Logger log = Logger.getLogger(FactoryConfigSample.class);
+
/**
* This test illustrates the following set of configuration options:
* <p>
@@ -86,7 +87,7 @@
* <tr><td>client side<td align="center">socket <td align="center">1</tr>
* </table>
*/
- public void testFactoriesBySettingConnectorAndClient()
+ public void testFactoriesBySettingInvokers()
{
try
{
@@ -102,13 +103,15 @@
int freeport = PortUtil.findFreePort(getHostName());
InvokerLocator locator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
Connector connector = new Connector(locator, sconfig);
+ connector.create();
- // Set ServerSocketFactory and SocketFactory in Connector.
+ // Set ServerSocketFactory and SocketFactory in ServerInvoker.
+ ServerInvoker serverInvoker = connector.getServerInvoker();
ServerSocketFactory ssf1 = getDefaultServerSocketFactory();
- connector.setServerSocketFactory(ssf1);
+ serverInvoker.setServerSocketFactory(ssf1);
SocketFactory sf1 = getDefaultCallbackSocketFactory();
- connector.setSocketFactory(sf1);
- connector.create();
+ serverInvoker.setSocketFactory(sf1);
+
connector.addInvocationHandler("sample", new SampleInvocationHandler());
connector.start();
@@ -123,11 +126,13 @@
// Create Client.
Client client = new Client(locator, cconfig);
+ client.connect();
- // Set SocketFactory in Client.
+ // Set SocketFactory in ClientInvoker.
SocketFactory sf2 = getDefaultSocketFactory();
- client.setSocketFactory(sf2);
- client.connect();
+ ClientInvoker clientInvoker = client.getInvoker();
+ clientInvoker.setSocketFactory(sf2);
+
System.out.println(getName() + ": " + client.invoke("test invoke()"));
@@ -135,15 +140,14 @@
///// Set up callback handling. ////
//////////////////////////////////////////////
- // Get callback Connector.
+ // Start callback Connector.
freeport = PortUtil.findFreePort(getHostName());
InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
Connector callbackConnector = new Connector(callbackLocator.getLocatorURI());
-
- // Set ServerSocketFactory in callback Connector
- ServerSocketFactory ssf2 = getDefaultCallbackServerSocketFactory();
- callbackConnector.setServerSocketFactory(ssf2);
callbackConnector.create();
+ ServerInvoker callbackServerInvoker = callbackConnector.getServerInvoker();
+ ServerSocketFactory ssf2 = getDefaultCallbackServerSocketFactory();
+ callbackServerInvoker.setServerSocketFactory(ssf2);
callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
callbackConnector.start();
@@ -175,7 +179,7 @@
* <tr><td>client side<td align="center">socket <td align="center">2</tr>
* </table>
*/
- public void testFactoriesBySettingInvokers()
+ public void testFactoriesBySettingConnectorAndClient()
{
try
{
@@ -191,15 +195,13 @@
int freeport = PortUtil.findFreePort(getHostName());
InvokerLocator locator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
Connector connector = new Connector(locator, sconfig);
- connector.create();
- // Set ServerSocketFactory and SocketFactory in ServerInvoker.
- ServerInvoker serverInvoker = connector.getServerInvoker();
+ // Set ServerSocketFactory and SocketFactory in Connector.
ServerSocketFactory ssf1 = getDefaultServerSocketFactory();
- serverInvoker.setServerSocketFactory(ssf1);
+ connector.setServerSocketFactory(ssf1);
SocketFactory sf1 = getDefaultCallbackSocketFactory();
- serverInvoker.setSocketFactory(sf1);
-
+ connector.setSocketFactory(sf1);
+ connector.create();
connector.addInvocationHandler("sample", new SampleInvocationHandler());
connector.start();
@@ -214,13 +216,11 @@
// Create Client.
Client client = new Client(locator, cconfig);
- client.connect();
- // Set SocketFactory in ClientInvoker.
+ // Set SocketFactory in Client.
SocketFactory sf2 = getDefaultSocketFactory();
- ClientInvoker clientInvoker = client.getInvoker();
- clientInvoker.setSocketFactory(sf2);
-
+ client.setSocketFactory(sf2);
+ client.connect();
System.out.println(getName() + ": " + client.invoke("test invoke()"));
@@ -228,14 +228,15 @@
///// Set up callback handling. ////
//////////////////////////////////////////////
- // Start callback Connector.
+ // Get callback Connector.
freeport = PortUtil.findFreePort(getHostName());
InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
Connector callbackConnector = new Connector(callbackLocator.getLocatorURI());
- callbackConnector.create();
- ServerInvoker callbackServerInvoker = callbackConnector.getServerInvoker();
+
+ // Set ServerSocketFactory in callback Connector
ServerSocketFactory ssf2 = getDefaultCallbackServerSocketFactory();
- callbackServerInvoker.setServerSocketFactory(ssf2);
+ callbackConnector.setServerSocketFactory(ssf2);
+ callbackConnector.create();
callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
callbackConnector.start();
@@ -351,8 +352,8 @@
* <table border cellpadding="5">
* <tr><td align="center"><b>side<td align="center"><b>factory<td><b>option</tr>
* <tr><td>server side<td align="center">server socket<td align="center">5</tr>
- * <tr><td>server side<td align="center">socket <td align="center">5</tr>
- * <tr><td>client side<td align="center">server socket<td align="center">5</tr>
+ * <tr><td>server side<td align="center">socket <td align="center">6</tr>
+ * <tr><td>client side<td align="center">server socket<td align="center">4</tr>
* <tr><td>client side<td align="center">socket <td align="center">1</tr>
* </table>
*/
@@ -470,11 +471,11 @@
* <tr><td align="center"><b>side<td align="center"><b>factory<td><b>option</tr>
* <tr><td>server side<td align="center">server socket<td align="center">7</tr>
* <tr><td>server side<td align="center">socket <td align="center">7</tr>
- * <tr><td>client side<td align="center">server socket<td align="center">4</tr>
+ * <tr><td>client side<td align="center">server socket<td align="center">5</tr>
* <tr><td>client side<td align="center">socket <td align="center">4</tr>
* </table>
*/
- public void testFactoriesByClassName()
+ public void testFactoriesByClassNameinConfig()
{
try
{
1.3 +4 -4 JBossRemoting/src/main/org/jboss/remoting/samples/config/factories/FactoryConfigSSLSample.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FactoryConfigSSLSample.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/samples/config/factories/FactoryConfigSSLSample.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- FactoryConfigSSLSample.java 24 Jul 2006 05:46:16 -0000 1.2
+++ FactoryConfigSSLSample.java 1 Aug 2006 06:24:25 -0000 1.3
@@ -188,7 +188,7 @@
* <table border cellpadding="5">
* <tr><td align="center"><b>side<td align="center"><b>factory<td><b>option</tr>
* <tr><td>server side<td align="center">server socket<td align="center">6</tr>
- * <tr><td>server side<td align="center">socket <td align="center">6</tr>
+ * <tr><td>server side<td align="center">socket <td align="center">5</tr>
* <tr><td>client side<td align="center">server socket<td align="center">1</tr>
* <tr><td>client side<td align="center">socket <td align="center">1</tr>
* </table>
@@ -196,7 +196,7 @@
* <b>Note.</b> There is no provision for using an <code>MBeanServer</code> on
* the client side.
*/
- public void testFactoriesByPassingMBean()
+ public void testFactoriesByPassingMBeanInConfig()
{
try
{
@@ -284,7 +284,7 @@
* <tr><td align="center"><b>side<td align="center"><b>factory<td><b>option</tr>
* <tr><td>server side<td align="center">server socket<td align="center">8</tr>
* <tr><td>server side<td align="center">socket <td align="center">8</tr>
- * <tr><td>client side<td align="center">server socket<td align="center">5</tr>
+ * <tr><td>client side<td align="center">server socket<td align="center">6</tr>
* <tr><td>client side<td align="center">socket <td align="center">5</tr>
* </table>
*/
@@ -381,7 +381,7 @@
* <tr><td align="center"><b>side<td align="center"><b>factory<td><b>option</tr>
* <tr><td>server side<td align="center">server socket<td align="center">9</tr>
* <tr><td>server side<td align="center">socket <td align="center">9</tr>
- * <tr><td>client side<td align="center">server socket<td align="center">6</tr>
+ * <tr><td>client side<td align="center">server socket<td align="center">7</tr>
* <tr><td>client side<td align="center">socket <td align="center">6</tr>
* </table>
*/
More information about the jboss-cvs-commits
mailing list