hammant 2002/10/13 04:54:28
Modified: altrmi ant.properties.sample build.xml
altrmi/src/java/org/apache/excalibur/altrmi/client
AltrmiFactory.java AltrmiHostContext.java
AltrmiInterfaceLookupFactory.java
altrmi/src/java/org/apache/excalibur/altrmi/client/impl
AbstractAltrmiFactory.java
AbstractFactoryHelper.java AbstractHostContext.java
AbstractInterfaceLookupFactory.java
ClientClassAltrmiFactory.java
ServerClassAltrmiFactory.java
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming
DefaultAltrmiContext.java
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped
PipedCustomStreamHostContext.java
PipedCustomStreamInvocationHandler.java
PipedObjectStreamHostContext.java
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/rmi
RmiFactoryHelper.java
altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket
SocketCustomStreamFactoryHelper.java
SocketCustomStreamHostContext.java
SocketCustomStreamInvocationHandler.java
SocketObjectStreamFactoryHelper.java
SocketObjectStreamHostContext.java
SocketObjectStreamInvocationHandler.java
altrmi/src/java/org/apache/excalibur/altrmi/common
AltrmiReplyConstants.java
OpenConnectionRequest.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl
AbstractServer.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters
InvocationHandlerAdapter.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback
CallbackServerClassAltrmiFactory.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped
AbstractPipedServer.java
PipedCustomStreamServer.java
PipedObjectStreamServer.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
AbstractCompleteSocketStreamServer.java
AbstractPartialSocketStreamServer.java
CompleteSocketCustomStreamServer.java
PartialSocketCustomStreamServer.java
PartialSocketObjectStreamServer.java
altrmi/src/test/org/apache/excalibur/altrmi/test/socket
CallbackEnabledCustomStreamTestCase.java
CustomStreamJNDITestCase.java
CustomStreamTestCase.java
JSXObjectStreamTestCase.java
ObjectStreamTestCase.java
Added: altrmi/src/java/org/apache/excalibur/altrmi/client/impl
AbstractSameVmBindableHostContext.java
altrmi/src/java/org/apache/excalibur/altrmi/common
SameVMReply.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
CompleteSocketCustomStreamPipedBinder.java
CompleteSocketCustomStreamPipedConnection.java
CompleteSocketObjectStreamPipedBinder.java
CompleteSocketObjectStreamPipedConnection.java
altrmi/src/test/org/apache/excalibur/altrmi/test/socket
CustomStreamOptmizedTestCase.java
Log:
Optmization now possible. Socket connections will be replaced with piped
ones for same-VM situations.
Revision Changes Path
1.5 +2 -2 jakarta-avalon-excalibur/altrmi/ant.properties.sample
Index: ant.properties.sample
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/ant.properties.sample,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ant.properties.sample 25 Aug 2002 20:52:14 -0000 1.4
+++ ant.properties.sample 13 Oct 2002 11:54:24 -0000 1.5
@@ -49,6 +49,6 @@
checkstyle.jar=${checkstyle.lib}/checkstyle-all-2.1.jar
# Stuff for AltRMI speed testing
-# uncomment this if you want a different number of iterations for the sped
test
+# uncomment this if you want a different number of iterations for the speed
test
# speedtest.iterations=10
1.40 +3 -2 jakarta-avalon-excalibur/altrmi/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- build.xml 26 Sep 2002 06:23:54 -0000 1.39
+++ build.xml 13 Oct 2002 11:54:24 -0000 1.40
@@ -18,6 +18,7 @@
<pathelement location="${checkstyle.jar}"/>
<pathelement path="${java.class.path}"/>
<pathelement location="${jakarta-bcel.jar}"/>
+ <pathelement path="lib/servlet.jar"/>
</path>
<path id="tools.class.path">
@@ -67,7 +68,7 @@
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkCommon"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkFramework"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkPool"/>
- <ant antfile="${basedir}/build.xml" target="checkBCEL"/>
+ <ant antfile="${basedir}/build.xml" target="checkBCEL"/>
</target>
<target name="dependencies-test" depends="dist-jar, dependencies"
@@ -255,7 +256,7 @@
<batchtest todir="${build.tests}">
<fileset dir="${build.testclasses}">
- <include name="**/test2/**/*TestCase.class"/>
+ <include name="**/test2/**/*TestCase.class-"/>
<exclude name="**/Abstract*"/>
</fileset>
</batchtest>
1.3 +13 -9
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiFactory.java
Index: AltrmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AltrmiFactory.java 24 Apr 2002 12:42:56 -0000 1.2
+++ AltrmiFactory.java 13 Oct 2002 11:54:24 -0000 1.3
@@ -20,15 +20,19 @@
{
/**
- * Method setHostContext
- *
- *
- * @param hostContext
- *
- *
- *
- * @throws IOException
+ * Set the HostContext
+ * @param hostContext the host context
+ * @throws IOException if a problem
*
*/
void setHostContext( AltrmiHostContext hostContext ) throws IOException;
+
+ /**
+ * Set the host context
+ * @param hostContext the host context
+ * @param allowOptimize allow optimize
+ * @throws IOException if a problem
+ */
+ void setHostContext( AltrmiHostContext hostContext, boolean
allowOptimize ) throws IOException;
+
}
1.5 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiHostContext.java
Index: AltrmiHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiHostContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AltrmiHostContext.java 5 Sep 2002 03:45:23 -0000 1.4
+++ AltrmiHostContext.java 13 Oct 2002 11:54:25 -0000 1.5
@@ -8,7 +8,7 @@
package org.apache.excalibur.altrmi.client;
/**
- * AltrmiHostContext, as the name suggests,describes the
+ * AltrmiHostContext, as the name suggests, describes the
* context of the calls made to the server which could be
* Over Piped Streams or Over Custom Transport or Direct calls etc ..
*
@@ -20,7 +20,7 @@
/**
* Return the Invocation Handler that can talk over
- * the transport this particular context address.
+ * the transport this particular context addresses.
* @return InvocationHandler
*
*/
1.3 +13 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiInterfaceLookupFactory.java
Index: AltrmiInterfaceLookupFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiInterfaceLookupFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AltrmiInterfaceLookupFactory.java 24 Apr 2002 12:42:56 -0000 1.2
+++ AltrmiInterfaceLookupFactory.java 13 Oct 2002 11:54:25 -0000 1.3
@@ -1,3 +1,10 @@
+/*
+ * Copyright (C) The Apache Software Foundation. All rights reserved.
+ *
+ * This software is published under the terms of the Apache Software License
+ * version 1.1, a copy of which has been included with this distribution in
+ * the LICENSE.txt file.
+ */
package org.apache.excalibur.altrmi.client;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
@@ -28,11 +35,12 @@
* - "NBO" is NotBeanOnly (castable to the interface)
*
* @param factoryString
+ * @param optimize
*
* @return
*
*/
- AltrmiInterfaceLookup getAltrmiInterfaceLookup( String factoryString )
+ AltrmiInterfaceLookup getAltrmiInterfaceLookup( String factoryString,
boolean optimize )
throws AltrmiConnectionException;
/**
@@ -41,6 +49,7 @@
*
* @param factoryString
* @param interfacesClassLoader
+ * @param optimize
*
* @return
*
@@ -48,5 +57,6 @@
*
*/
AltrmiInterfaceLookup getAltrmiInterfaceLookup(
- String factoryString, ClassLoader interfacesClassLoader ) throws
AltrmiConnectionException;
+ String factoryString, ClassLoader interfacesClassLoader, boolean
optimize
+ ) throws AltrmiConnectionException;
}
1.9 +86 -45
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractAltrmiFactory.java
Index: AbstractAltrmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractAltrmiFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractAltrmiFactory.java 4 Sep 2002 11:01:23 -0000 1.8
+++ AbstractAltrmiFactory.java 13 Oct 2002 11:54:25 -0000 1.9
@@ -10,23 +10,28 @@
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.HashMap;
+import java.rmi.server.UID;
+
import org.apache.excalibur.altrmi.client.AltrmiFactory;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import org.apache.excalibur.altrmi.client.AltrmiProxy;
-import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
-import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
+import org.apache.excalibur.altrmi.common.OpenConnectionRequest;
+import org.apache.excalibur.altrmi.common.SameVMReply;
import org.apache.excalibur.altrmi.common.AltrmiReply;
+import org.apache.excalibur.altrmi.common.NotPublishedReply;
import org.apache.excalibur.altrmi.common.AltrmiReplyConstants;
+import org.apache.excalibur.altrmi.common.LookupRequest;
+import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.common.AltrmiAuthentication;
import org.apache.excalibur.altrmi.common.ExceptionReply;
-import org.apache.excalibur.altrmi.common.FacadeRefHolder;
+import org.apache.excalibur.altrmi.common.LookupReply;
import org.apache.excalibur.altrmi.common.ListReply;
import org.apache.excalibur.altrmi.common.ListRequest;
-import org.apache.excalibur.altrmi.common.LookupReply;
-import org.apache.excalibur.altrmi.common.LookupRequest;
-import org.apache.excalibur.altrmi.common.NotPublishedReply;
+import org.apache.excalibur.altrmi.common.FacadeRefHolder;
import org.apache.excalibur.altrmi.common.OpenConnectionReply;
-import org.apache.excalibur.altrmi.common.OpenConnectionRequest;
+
/**
* Class AbstractAltrmiFactory
@@ -39,11 +44,13 @@
public abstract class AbstractAltrmiFactory implements AltrmiFactory
{
- protected AbstractHostContext mHostContext;
- protected final HashMap mRefObjs = new HashMap();
- private final boolean mBeanOnly;
- private transient String mTextToSign;
- protected Long mSession;
+ private static final UID U_ID = new UID((short)20729);
+ protected AbstractHostContext m_hostContext;
+ protected AltrmiClientInvocationHandler m_clientInvocationHandler;
+ protected final HashMap m_refObjs = new HashMap();
+ private final boolean m_beanOnly;
+ private transient String m_textToSign;
+ protected Long m_session;
/**
* Constructor AbstractAltrmiFactory
@@ -54,7 +61,7 @@
*/
public AbstractAltrmiFactory( boolean beanOnly )
{
- mBeanOnly = beanOnly;
+ m_beanOnly = beanOnly;
}
/**
@@ -66,40 +73,75 @@
*/
public final boolean isBeanOnly()
{
- return mBeanOnly;
+ return m_beanOnly;
}
/**
- * Method setHostContext
- *
- *
- * @param hostContext
- *
- *
- *
+ * Set the HostContext (defauts to optimize = true)
+ * @param hostContext the host context
+ * @throws IOException if a problem
*/
- public final void setHostContext( AltrmiHostContext hostContext ) throws
IOException
+ public void setHostContext(AltrmiHostContext hostContext) throws
IOException {
+ setHostContext(hostContext, true);
+ }
+
+ /**
+ * Set the host context
+ * @param hostContext the host context
+ * @param allowOptimize allow optimization
+ * @throws IOException if a problem
+ */
+ public void setHostContext( AltrmiHostContext hostContext, boolean
allowOptimize ) throws IOException
{
- if( mHostContext == null )
+ if( m_hostContext == null )
{
- mHostContext = (AbstractHostContext)hostContext;
+ m_hostContext = (AbstractHostContext) hostContext;
+ m_clientInvocationHandler =
m_hostContext.getClientInvocationHandler();
}
- (
(AbstractClientInvocationHandler)mHostContext.getClientInvocationHandler()
).initialize();
- AltrmiReply ar =
- mHostContext.getClientInvocationHandler().handleInvocation( new
OpenConnectionRequest() );
+ ( (AbstractClientInvocationHandler) m_clientInvocationHandler
).initialize();
+
+ UID machineID = allowOptimize ? U_ID : null;
- if( ar instanceof OpenConnectionReply )
+ if(!(m_hostContext instanceof AbstractSameVmBindableHostContext))
{
- mTextToSign = ( (OpenConnectionReply)ar ).getTextToSign();
- mSession = ( (OpenConnectionReply)ar ).getSession();
+ machineID = null;
}
+
+ AltrmiReply reply =
+ m_clientInvocationHandler.handleInvocation(new
OpenConnectionRequest( machineID ) );
+
+ if( reply instanceof SameVMReply )
+ {
+ if (m_hostContext instanceof AbstractSameVmBindableHostContext)
+ {
+ AbstractSameVmBindableHostContext sameVmBindableHostContext =
+ (AbstractSameVmBindableHostContext) m_hostContext;
+ m_hostContext =
sameVmBindableHostContext.makeSameVmHostContext();
+ m_clientInvocationHandler =
m_hostContext.getClientInvocationHandler();
+ reply = m_clientInvocationHandler.handleInvocation(new
OpenConnectionRequest() );
+
+ }
+ else
+ {
+ throw new IOException("SameVM instruction for non rebindable
host context.");
+ }
+
+ }
+
+ if( reply instanceof OpenConnectionReply )
+ {
+ m_textToSign = ( (OpenConnectionReply) reply ).getTextToSign();
+ m_session = ( (OpenConnectionReply) reply ).getSession();
+ }
+
else
{
- //TODO
+ throw new IOException("Setting of host context blocked for
reasons of unknown, server-side reply: (" +
+ reply.getClass().getName() + ")");
}
}
@@ -120,9 +162,8 @@
{
AltrmiReply ar =
- mHostContext.getClientInvocationHandler()
- .handleInvocation( new LookupRequest( publishedServiceName,
altrmiAuthentication,
- mSession ) );
+ m_clientInvocationHandler.handleInvocation( new LookupRequest(
publishedServiceName, altrmiAuthentication,
+ m_session ) );
if( ar.getReplyCode() >= AltrmiReplyConstants.PROBLEMREPLY )
{
@@ -173,9 +214,9 @@
LookupReply lr = (LookupReply)ar;
DefaultProxyHelper baseObj = new DefaultProxyHelper( this,
-
mHostContext.getClientInvocationHandler(),
+
m_clientInvocationHandler,
publishedServiceName, "Main",
-
lr.getReferenceID(), mSession );
+
lr.getReferenceID(), m_session );
Object retVal = getInstance( publishedServiceName, "Main", baseObj,
isBeanOnly() );
baseObj.registerImplObject( retVal );
@@ -207,10 +248,10 @@
synchronized( this )
{
- mRefObjs.put( referenceID, new WeakReference( obj ) );
+ m_refObjs.put( referenceID, new WeakReference( obj ) );
}
- //Object o = mRefObjs.get(referenceID);
+ //Object o = m_refObjs.get(referenceID);
}
/**
@@ -243,7 +284,7 @@
synchronized( this )
{
- wr = (WeakReference)mRefObjs.get( referenceID );
+ wr = (WeakReference)m_refObjs.get( referenceID );
}
if( wr == null )
@@ -251,14 +292,14 @@
return null;
}
- //System.out.println("size = " + mRefObjs.size());
+ //System.out.println("size = " + m_refObjs.size());
Object obj = wr.get();
if( obj == null )
{
//System.out.println(" none for " + referenceID);
- mRefObjs.remove( referenceID );
+ m_refObjs.remove( referenceID );
}
return obj;
@@ -289,7 +330,7 @@
*/
public String getTextToSignForAuthentication()
{
- return mTextToSign;
+ return m_textToSign;
}
/**
@@ -298,7 +339,7 @@
public String[] list()
{
- AltrmiReply ar =
mHostContext.getClientInvocationHandler().handleInvocation( new ListRequest() );
+ AltrmiReply ar = m_clientInvocationHandler.handleInvocation( new
ListRequest() );
if( ar instanceof ListReply )
{
@@ -354,7 +395,7 @@
}
else // Let the specific InvocationHandlers be given the last
chance to modify the arguments.
{
-
args[i]=mHostContext.getClientInvocationHandler().resolveArgument(methodSignature,argClasses[i],args[i]);
+ args[i] =
m_clientInvocationHandler.resolveArgument(methodSignature,argClasses[i],args[i]);
}
}
}
1.4 +4 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractFactoryHelper.java
Index: AbstractFactoryHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractFactoryHelper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractFactoryHelper.java 24 Apr 2002 12:42:56 -0000 1.3
+++ AbstractFactoryHelper.java 13 Oct 2002 11:54:25 -0000 1.4
@@ -64,15 +64,16 @@
*
*
* @param factoryString
+ * @param optimize
*
* @return
*
* @throws AltrmiConnectionException
*
*/
- public final AltrmiInterfaceLookup getAltrmiInterfaceLookup( String
factoryString )
+ public final AltrmiInterfaceLookup getAltrmiInterfaceLookup( String
factoryString, boolean optimize )
throws AltrmiConnectionException
{
- return getAltrmiInterfaceLookup( factoryString,
this.getClass().getClassLoader() );
+ return getAltrmiInterfaceLookup( factoryString,
this.getClass().getClassLoader(), optimize );
}
}
1.5 +6 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractHostContext.java
Index: AbstractHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractHostContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractHostContext.java 6 May 2002 18:14:36 -0000 1.4
+++ AbstractHostContext.java 13 Oct 2002 11:54:25 -0000 1.5
@@ -60,4 +60,9 @@
{
mAltrmiClientInvocationHandler.setAltrmiConnectionListener(
altrmiConnectionListener );
}
+
+ public AltrmiHostContext makeSameVmHostContext(String key) {
+ throw new UnsupportedOperationException();
+ }
+
}
1.4 +6 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractInterfaceLookupFactory.java
Index: AbstractInterfaceLookupFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractInterfaceLookupFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractInterfaceLookupFactory.java 24 Apr 2002 12:42:56 -0000
1.3
+++ AbstractInterfaceLookupFactory.java 13 Oct 2002 11:54:25 -0000
1.4
@@ -40,10 +40,10 @@
* @throws AltrmiConnectionException
*
*/
- public final AltrmiInterfaceLookup getAltrmiInterfaceLookup( String
factoryString )
+ public final AltrmiInterfaceLookup getAltrmiInterfaceLookup( String
factoryString, boolean optimize )
throws AltrmiConnectionException
{
- return getAltrmiInterfaceLookup( factoryString,
this.getClass().getClassLoader() );
+ return getAltrmiInterfaceLookup( factoryString,
this.getClass().getClassLoader(), optimize );
}
/**
@@ -59,7 +59,7 @@
*
*/
public AltrmiInterfaceLookup getAltrmiInterfaceLookup(
- String factoryString, ClassLoader interfacesClassLoader )
+ String factoryString, ClassLoader interfacesClassLoader, boolean
optimize )
throws AltrmiConnectionException
{
@@ -70,7 +70,7 @@
if( factoryString.startsWith( factory.factoryStringPrefix ) )
{
return factory.altrmiInterfaceLookupFactory
- .getAltrmiInterfaceLookup( factoryString,
interfacesClassLoader );
+ .getAltrmiInterfaceLookup( factoryString,
interfacesClassLoader, optimize );
}
}
1.8 +2 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ClientClassAltrmiFactory.java
Index: ClientClassAltrmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ClientClassAltrmiFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ClientClassAltrmiFactory.java 5 Sep 2002 22:22:36 -0000 1.7
+++ ClientClassAltrmiFactory.java 13 Oct 2002 11:54:25 -0000 1.8
@@ -102,6 +102,6 @@
*/
public void close()
{
- mHostContext.getClientInvocationHandler().close();
+ m_hostContext.getClientInvocationHandler().close();
}
}
1.9 +4 -4
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ServerClassAltrmiFactory.java
Index: ServerClassAltrmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/ServerClassAltrmiFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ServerClassAltrmiFactory.java 23 May 2002 21:37:19 -0000 1.8
+++ ServerClassAltrmiFactory.java 13 Oct 2002 11:54:25 -0000 1.9
@@ -71,7 +71,7 @@
try
{
AltrmiReply ar =
- mHostContext.getClientInvocationHandler()
+ m_hostContext.getClientInvocationHandler()
.handleInvocation( new ClassRequest(
publishedServiceName, objectName ) );
if( ar.getReplyCode() >= AltrmiReplyConstants.PROBLEMREPLY )
@@ -98,7 +98,7 @@
+ " not published on
Server" );
}
- tcl = new TransportedClassLoader(
mHostContext.getClientInvocationHandler()
+ tcl = new TransportedClassLoader(
m_hostContext.getClientInvocationHandler()
.getInterfacesClassLoader() );
tcl.add( beanClassName, cr.getBeanClassBytes() );
@@ -179,6 +179,6 @@
*/
public void close()
{
- mHostContext.getClientInvocationHandler().close();
+ m_hostContext.getClientInvocationHandler().close();
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractSameVmBindableHostContext.java
Index: AbstractSameVmBindableHostContext.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.client.impl;
import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
import java.io.IOException;
public abstract class AbstractSameVmBindableHostContext extends
AbstractHostContext{
public AbstractSameVmBindableHostContext(AltrmiClientInvocationHandler
altrmiClientInvocationHandler)
{
super(altrmiClientInvocationHandler);
}
/**
* Make a HostContext for this using SameVM connections nstead of socket
based ones.
* @return the HostContext
* @throws IOException if a problem
*/
public abstract AbstractHostContext makeSameVmHostContext() throws
IOException;
}
1.4 +87 -56
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming/DefaultAltrmiContext.java
Index: DefaultAltrmiContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/naming/DefaultAltrmiContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultAltrmiContext.java 24 Aug 2002 11:39:05 -0000 1.3
+++ DefaultAltrmiContext.java 13 Oct 2002 11:54:25 -0000 1.4
@@ -23,6 +23,7 @@
*
*
* @author Vinay Chandrasekharan <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
+ * @author Paul Hammant
* @version $Revision$
*/
public class DefaultAltrmiContext implements Context
@@ -51,71 +52,101 @@
String proxyDetails = null;
String beanDetails = null;
ClassLoader interfacesClassLoader = null;
+ boolean optimize;
proxyDetails = (String)env.get( "proxy.type" );
- if( proxyDetails == null )
{
- proxyDetails = "S";
- }
- else if( proxyDetails.equals( "ClientSideClasses" ) )
- {
- proxyDetails = "C";
- }
- else if( proxyDetails.equals( "ServerSideClasses" ) )
- {
- proxyDetails = "S";
- }
- else
- {
- throw new NamingException(
- "proxy.type should be 'ClientSideClasses' or
'ServerSideClasses', you specified "
- + proxyDetails );
+ if( proxyDetails == null )
+ {
+ proxyDetails = "S";
+ }
+ else if( proxyDetails.equals( "ClientSideClasses" ) )
+ {
+ proxyDetails = "C";
+ }
+ else if( proxyDetails.equals( "ServerSideClasses" ) )
+ {
+ proxyDetails = "S";
+ }
+ else
+ {
+ throw new NamingException(
+ "proxy.type should be 'ClientSideClasses' or
'ServerSideClasses', you specified "
+ + proxyDetails );
+ }
}
beanDetails = (String)env.get( "bean.type" );
- if( beanDetails == null )
- {
- beanDetails = "NBO";
- }
- else if( beanDetails.equals( "NotBeanOnly" ) )
- {
- beanDetails = "NBO";
- }
- else if( beanDetails.equals( "BeanOnly" ) )
- {
- beanDetails = "BO";
- }
- else
- {
- throw new NamingException(
- "proxy.type should be 'BeanOnly' or 'NotBeanOnly', you
specified " + beanDetails );
- }
-
- interfacesClassLoader = (ClassLoader)env.get(
"interfaces.classloader" );
-
- if( interfacesClassLoader == null )
- {
- interfacesClassLoader = this.getClass().getClassLoader();
- }
-
- try
- {
-
- //System.out.println("iurl[" + transportStream + ":" + host +
":" + port + ":"
- // + proxyDetails + ":" + beanDetails + "]");
- altrmiInterfaceLookup =
- altrmiInterfaceLookupFactory
- .getAltrmiInterfaceLookup( transportStream + ":" + host +
":" + port + ":"
- + proxyDetails + ":"
- + beanDetails,
interfacesClassLoader );
- }
- catch( AltrmiConnectionException ace )
{
- ace.printStackTrace();
+ if( beanDetails == null )
+ {
+ beanDetails = "NBO";
+ }
+ else if( beanDetails.equals( "NotBeanOnly" ) )
+ {
+ beanDetails = "NBO";
+ }
+ else if( beanDetails.equals( "BeanOnly" ) )
+ {
+ beanDetails = "BO";
+ }
+ else
+ {
+ throw new NamingException(
+ "proxy.type should be 'BeanOnly' or 'NotBeanOnly', you
specified " + beanDetails );
+ }
+ }
+
+ String optimizeStr = (String)env.get( "optimize" );
+
+ {
+ if( optimizeStr == null )
+ {
+ optimize = true;
+ }
+ else if( optimizeStr.equals( "true" ) )
+ {
+ optimize = true;
+ }
+ else if( optimizeStr.equals( "false" ) )
+ {
+ optimize = false;
+ }
+ else
+ {
+ throw new NamingException(
+ "optimize should be 'true' or 'false', you specified " +
optimizeStr );
+ }
+ }
+
+
+ {
+ interfacesClassLoader = (ClassLoader)env.get(
"interfaces.classloader" );
+
+ if( interfacesClassLoader == null )
+ {
+ interfacesClassLoader = this.getClass().getClassLoader();
+ }
+
+ try
+ {
+
+ //System.out.println("iurl[" + transportStream + ":" + host
+ ":" + port + ":"
+ // + proxyDetails + ":" + beanDetails +
"]");
+ altrmiInterfaceLookup =
+ altrmiInterfaceLookupFactory
+ .getAltrmiInterfaceLookup( transportStream + ":" + host
+ ":" + port + ":"
+ + proxyDetails + ":"
+ + beanDetails,
interfacesClassLoader, optimize );
+ }
+ catch( AltrmiConnectionException ace )
+ {
+ ace.printStackTrace();
- throw new NamingException( ace.getMessage() );
+ throw new NamingException( ace.getMessage() );
+ }
}
}
1.2 +6 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedCustomStreamHostContext.java
Index: PipedCustomStreamHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedCustomStreamHostContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PipedCustomStreamHostContext.java 24 Aug 2002 10:05:53 -0000 1.1
+++ PipedCustomStreamHostContext.java 13 Oct 2002 11:54:25 -0000 1.2
@@ -28,16 +28,17 @@
*
*
*
- * @param is
- * @param os
+ * @param inputStream
+ * @param outputStream
*
* @throws AltrmiConnectionException
*
*/
- public PipedCustomStreamHostContext( PipedInputStream is,
PipedOutputStream os )
+ public PipedCustomStreamHostContext( PipedInputStream inputStream,
+ PipedOutputStream outputStream )
throws AltrmiConnectionException
{
- super( new PipedCustomStreamInvocationHandler( is, os ) );
+ super( new PipedCustomStreamInvocationHandler( inputStream,
outputStream ) );
}
/**
@@ -49,7 +50,6 @@
*/
public void initialize() throws IOException
{
- System.out.println( "init1" );
( (PipedCustomStreamInvocationHandler)mAltrmiClientInvocationHandler
).initialize();
}
}
1.3 +16 -13
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedCustomStreamInvocationHandler.java
Index: PipedCustomStreamInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedCustomStreamInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipedCustomStreamInvocationHandler.java 24 Apr 2002 12:42:57 -0000
1.2
+++ PipedCustomStreamInvocationHandler.java 13 Oct 2002 11:54:25 -0000
1.3
@@ -15,6 +15,9 @@
import
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter;
import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.common.AltrmiReply;
+import org.apache.excalibur.altrmi.common.AltrmiRequest;
+import org.apache.excalibur.altrmi.common.MethodRequest;
/**
* Class PipedCustomStreamInvocationHandler
@@ -30,48 +33,48 @@
* Constructor PipedCustomStreamInvocationHandler
*
*
- * @param is
- * @param os
+ * @param inputStream
+ * @param outputStream
*
* @throws AltrmiConnectionException
*
*/
- public PipedCustomStreamInvocationHandler( PipedInputStream is,
PipedOutputStream os )
+ public PipedCustomStreamInvocationHandler( PipedInputStream inputStream,
PipedOutputStream outputStream )
throws AltrmiConnectionException
{
- super( is, os,
PipedCustomStreamInvocationHandler.class.getClassLoader() );
+ super( inputStream, outputStream,
PipedCustomStreamInvocationHandler.class.getClassLoader() );
}
/**
* Constructor PipedCustomStreamInvocationHandler
*
*
- * @param is
- * @param os
+ * @param inputStream
+ * @param outputStream
* @param interfacesClassLoader
*
* @throws AltrmiConnectionException
*
*/
public PipedCustomStreamInvocationHandler(
- PipedInputStream is, PipedOutputStream os, ClassLoader
interfacesClassLoader )
+ PipedInputStream inputStream, PipedOutputStream outputStream,
ClassLoader interfacesClassLoader )
throws AltrmiConnectionException
{
- super( is, os, interfacesClassLoader );
+ super( inputStream, outputStream, interfacesClassLoader );
}
protected ClientStreamReadWriter createClientStreamReadWriter(
- InputStream in, OutputStream out ) throws IOException
+ InputStream inputStream, OutputStream outputStream ) throws
IOException
{
- return new ClientCustomStreamReadWriter( in, out,
+ return new ClientCustomStreamReadWriter( inputStream, outputStream,
PipedCustomStreamInvocationHandler.class
.getClassLoader() );
}
protected ClientStreamReadWriter createClientStreamReadWriter(
- InputStream in, OutputStream out, ClassLoader classLoader ) throws
IOException
+ InputStream inputStream, OutputStream outputStream, ClassLoader
classLoader ) throws IOException
{
- return new ClientCustomStreamReadWriter( in, out, classLoader );
+ return new ClientCustomStreamReadWriter( inputStream, outputStream,
classLoader );
}
}
1.3 +6 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedObjectStreamHostContext.java
Index: PipedObjectStreamHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/piped/PipedObjectStreamHostContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PipedObjectStreamHostContext.java 24 Apr 2002 12:42:57 -0000 1.2
+++ PipedObjectStreamHostContext.java 13 Oct 2002 11:54:25 -0000 1.3
@@ -28,16 +28,17 @@
*
*
*
- * @param is
- * @param os
+ * @param inputStream
+ * @param outputStream
*
* @throws AltrmiConnectionException
*
*/
- public PipedObjectStreamHostContext( PipedInputStream is,
PipedOutputStream os )
+ public PipedObjectStreamHostContext( PipedInputStream inputStream,
+ PipedOutputStream outputStream )
throws AltrmiConnectionException
{
- super( new PipedObjectStreamInvocationHandler( is, os ) );
+ super( new PipedObjectStreamInvocationHandler( inputStream,
outputStream ) );
}
/**
@@ -49,7 +50,6 @@
*/
public void initialize() throws IOException
{
- System.out.println( "init1" );
( (PipedObjectStreamInvocationHandler)mAltrmiClientInvocationHandler
).initialize();
}
}
1.3 +2 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/rmi/RmiFactoryHelper.java
Index: RmiFactoryHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/rmi/RmiFactoryHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RmiFactoryHelper.java 24 Apr 2002 12:42:57 -0000 1.2
+++ RmiFactoryHelper.java 13 Oct 2002 11:54:26 -0000 1.3
@@ -38,7 +38,7 @@
*
*/
public AltrmiInterfaceLookup getAltrmiInterfaceLookup(
- String factoryString, ClassLoader interfacesClassLoader )
+ String factoryString, ClassLoader interfacesClassLoader, boolean
optimize )
throws AltrmiConnectionException
{
1.3 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamFactoryHelper.java
Index: SocketCustomStreamFactoryHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamFactoryHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketCustomStreamFactoryHelper.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketCustomStreamFactoryHelper.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -38,7 +38,7 @@
*
*/
public AltrmiInterfaceLookup getAltrmiInterfaceLookup(
- String factoryString, ClassLoader interfacesClassLoader )
+ String factoryString, ClassLoader interfacesClassLoader, boolean
optimize)
throws AltrmiConnectionException
{
@@ -51,7 +51,7 @@
try
{
- af.setHostContext( hc );
+ af.setHostContext( hc, optimize );
}
catch( IOException e )
{
1.3 +45 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamHostContext.java
Index: SocketCustomStreamHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamHostContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketCustomStreamHostContext.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketCustomStreamHostContext.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -7,8 +7,18 @@
*/
package org.apache.excalibur.altrmi.client.impl.socket;
+import
org.apache.excalibur.altrmi.client.impl.piped.PipedCustomStreamHostContext;
+import
org.apache.excalibur.altrmi.client.impl.AbstractSameVmBindableHostContext;
import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.registry.Registry;
+import org.apache.excalibur.altrmi.registry.Bound;
+import org.apache.excalibur.altrmi.registry.Binder;
+import org.apache.excalibur.altrmi.registry.BindException;
+
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.IOException;
/**
* Class SocketCustomStreamHostContext
@@ -17,9 +27,11 @@
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @version $Revision$
*/
-public class SocketCustomStreamHostContext extends AbstractHostContext
+public class SocketCustomStreamHostContext extends
AbstractSameVmBindableHostContext
{
+ private int m_port;
+
/**
* Constructor SocketCustomStreamHostContext
*
@@ -36,6 +48,7 @@
super( new SocketCustomStreamInvocationHandler( host, port,
SocketCustomStreamHostContext.class
.getClassLoader() )
);
+ m_port = port;
}
/**
@@ -53,5 +66,35 @@
throws AltrmiConnectionException
{
super( new SocketCustomStreamInvocationHandler( host, port,
classLoader ) );
+ m_port = port;
+ }
+
+ /**
+ * Make a HostContext for this using SameVM connections nstead of socket
based ones.
+ * @return the HostContext
+ * @throws IOException if a problem
+ */
+ public AbstractHostContext makeSameVmHostContext() throws IOException
+ {
+ PipedInputStream in = new PipedInputStream();
+ PipedOutputStream out = new PipedOutputStream();
+ try
+ {
+ Registry registry = Registry.getInstance();
+ Binder binder = registry.get("/.altrmi/optimizations/port=" +
m_port);
+ Bound bound = binder.bind(new Object[] {in, out});
+ PipedCustomStreamHostContext pipedCustomStreamHostContext
+ = new PipedCustomStreamHostContext(in, out);
+ pipedCustomStreamHostContext.initialize();
+ return pipedCustomStreamHostContext;
+ }
+ catch (BindException e)
+ {
+ throw new IOException("Naming exception during bind :" +
e.getMessage());
+ }
+ catch (AltrmiConnectionException e)
+ {
+ throw new IOException("Connection exception during bind :" +
e.getMessage());
+ }
}
}
1.3 +15 -5
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamInvocationHandler.java
Index: SocketCustomStreamInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketCustomStreamInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketCustomStreamInvocationHandler.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketCustomStreamInvocationHandler.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -13,6 +13,9 @@
import
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter;
import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.common.AltrmiReply;
+import org.apache.excalibur.altrmi.common.AltrmiRequest;
+import org.apache.excalibur.altrmi.common.MethodRequest;
/**
* Class SocketCustomStreamInvocationHandler
@@ -29,11 +32,11 @@
* Constructor SocketCustomStreamInvocationHandler
*
*
- * @param host
- * @param port
- * @param classLoader
+ * @param host the host name
+ * @param port the port
+ * @param classLoader the classloader for deserialization hints.
*
- * @throws AltrmiConnectionException
+ * @throws AltrmiConnectionException if a problem
*
*/
public SocketCustomStreamInvocationHandler( String host, int port,
ClassLoader classLoader )
@@ -42,6 +45,13 @@
super( host, port, classLoader );
}
+ /**
+ * Create a client stream read/writer
+ * @param in the input stream
+ * @param out the output stream
+ * @return the read/writer
+ * @throws IOException if a problem
+ */
protected ClientStreamReadWriter createClientStreamReadWriter(
InputStream in, OutputStream out ) throws IOException
{
1.3 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamFactoryHelper.java
Index: SocketObjectStreamFactoryHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamFactoryHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketObjectStreamFactoryHelper.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketObjectStreamFactoryHelper.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -38,7 +38,7 @@
*
*/
public AltrmiInterfaceLookup getAltrmiInterfaceLookup(
- String factoryString, ClassLoader interfacesClassLoader )
+ String factoryString, ClassLoader interfacesClassLoader, boolean
optimize )
throws AltrmiConnectionException
{
@@ -51,7 +51,7 @@
try
{
- af.setHostContext( hc );
+ af.setHostContext( hc, optimize );
}
catch( IOException e )
{
1.3 +45 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamHostContext.java
Index: SocketObjectStreamHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamHostContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketObjectStreamHostContext.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketObjectStreamHostContext.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -8,7 +8,16 @@
package org.apache.excalibur.altrmi.client.impl.socket;
import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
+import
org.apache.excalibur.altrmi.client.impl.piped.PipedObjectStreamHostContext;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
+import org.apache.excalibur.altrmi.registry.Registry;
+import org.apache.excalibur.altrmi.registry.Binder;
+import org.apache.excalibur.altrmi.registry.Bound;
+import org.apache.excalibur.altrmi.registry.BindException;
+
+import java.io.PipedInputStream;
+import java.io.IOException;
+import java.io.PipedOutputStream;
/**
* Class SocketObjectStreamHostContext
@@ -22,6 +31,7 @@
private String mObjectOutputStreamClassName;
private String mObjectInputStreamClassName;
+ private int m_port;
/**
* Constructor SocketObjectStreamHostContext
@@ -39,6 +49,7 @@
super( new SocketObjectStreamInvocationHandler( host, port, null,
null,
SocketObjectStreamHostContext.class
.getClassLoader() )
);
+ m_port = port;
}
/**
@@ -56,6 +67,7 @@
throws AltrmiConnectionException
{
super( new SocketObjectStreamInvocationHandler( host, port, null,
null, classLoader ) );
+ m_port = port;
}
/**
@@ -79,6 +91,7 @@
objectOutputStreamClassName,
SocketObjectStreamHostContext.class
.getClassLoader() )
);
+ m_port = port;
}
/**
@@ -100,5 +113,36 @@
{
super( new SocketObjectStreamInvocationHandler( host, port,
objectInputStreamClassName,
objectOutputStreamClassName, classLoader ) );
+ m_port = port;
}
+
+ /**
+ * Make a HostContext for this using SameVM connections nstead of socket
based ones.
+ * @return the HostContext
+ * @throws IOException if a problem
+ */
+ public AbstractHostContext makeSameVmHostContext() throws IOException
+ {
+ PipedInputStream in = new PipedInputStream();
+ PipedOutputStream out = new PipedOutputStream();
+ try
+ {
+ Registry registry = Registry.getInstance();
+ Binder binder = registry.get("/.altrmi/optimizations/port=" +
m_port);
+ Bound bound = binder.bind(new Object[] {in, out});
+ PipedObjectStreamHostContext pipedObjectStreamHostContext
+ = new PipedObjectStreamHostContext(in, out);
+ pipedObjectStreamHostContext.initialize();
+ return pipedObjectStreamHostContext;
+ }
+ catch (BindException e)
+ {
+ throw new IOException("Naming exception during bind :" +
e.getMessage());
+ }
+ catch (AltrmiConnectionException e)
+ {
+ throw new IOException("Connection exception during bind :" +
e.getMessage());
+ }
+ }
+
}
1.3 +15 -8
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamInvocationHandler.java
Index: SocketObjectStreamInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/socket/SocketObjectStreamInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SocketObjectStreamInvocationHandler.java 24 Apr 2002 12:42:58 -0000
1.2
+++ SocketObjectStreamInvocationHandler.java 13 Oct 2002 11:54:26 -0000
1.3
@@ -29,16 +29,16 @@
private String mObjectInputStreamClassName;
/**
- * Constructor SocketObjectStreamInvocationHandler.
+ * Const a SocketObjectStreamInvocationHandler.
*
*
- * @param host
- * @param port
- * @param objectInputStreamClassName
- * @param objectOutputStreamClassName
- * @param classLoader
+ * @param host the host
+ * @param port the port
+ * @param objectInputStreamClassName a classname for the input stream
+ * @param objectOutputStreamClassName a classname for the output stream
+ * @param classLoader a classloader for deserialization hints.
*
- * @throws AltrmiConnectionException
+ * @throws AltrmiConnectionException if a problem
*
*/
public SocketObjectStreamInvocationHandler(
@@ -54,6 +54,13 @@
mObjectOutputStreamClassName = objectOutputStreamClassName;
}
+ /**
+ * Create a client stream read/writer
+ * @param in the input stream
+ * @param out the output stream
+ * @return the read/writer
+ * @throws IOException if a problem
+ */
protected ClientStreamReadWriter createClientStreamReadWriter(
InputStream in, OutputStream out ) throws IOException
{
1.2 +7 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/AltrmiReplyConstants.java
Index: AltrmiReplyConstants.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/AltrmiReplyConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AltrmiReplyConstants.java 23 May 2002 21:37:19 -0000 1.1
+++ AltrmiReplyConstants.java 13 Oct 2002 11:54:26 -0000 1.2
@@ -60,6 +60,12 @@
*/
int GCREPLY = 10;
+ /**
+ * An instruction try again in local modes. Used instread of an
OpenConnectionReply.
+ */
+ int SAMEVMREPLY = 11;
+
+
// 'bad' replies after 100
/**
1.5 +71 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/OpenConnectionRequest.java
Index: OpenConnectionRequest.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/OpenConnectionRequest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OpenConnectionRequest.java 23 May 2002 21:37:19 -0000 1.4
+++ OpenConnectionRequest.java 13 Oct 2002 11:54:26 -0000 1.5
@@ -7,6 +7,11 @@
*/
package org.apache.excalibur.altrmi.common;
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.rmi.server.UID;
+
/**
* Class OpenConnectionRequest
*
@@ -18,6 +23,33 @@
{
static final long serialVersionUID = 1773735791378198918L;
+ private UID m_uid;
+
+ /**
+ * Default constructor for externalization
+ */
+ public OpenConnectionRequest()
+ {
+ }
+
+ /**
+ * Construct a request with a UID for the client machine
+ * @param uid the machine ID
+ */
+ public OpenConnectionRequest(UID uid)
+ {
+ m_uid = uid;
+ }
+
+ /**
+ * Get the machine ID
+ * @return the machine ID
+ */
+ public UID getMachineID()
+ {
+ return m_uid;
+ }
+
/**
* Gets number that represents type for this class.
* This is quicker than instanceof for type checking.
@@ -30,4 +62,42 @@
{
return AltrmiRequestConstants.OPENCONNECTIONREQUEST;
}
+
+ /**
+ * The object implements the writeExternal method to save its contents
+ * by calling the methods of DataOutput for its primitive values or
+ * calling the writeObject method of ObjectOutput for objects, strings,
+ * and arrays.
+ *
+ * @serialData Overriding methods should use this tag to describe
+ * the data layout of this Externalizable object.
+ * List the sequence of element types and, if possible,
+ * relate the element to a public/protected field and/or
+ * method of this Externalizable class.
+ *
+ * @param out the stream to write the object to
+ * @exception IOException Includes any I/O exceptions that may occur
+ */
+ public void writeExternal( ObjectOutput out ) throws IOException
+ {
+ out.writeObject( m_uid );
+ }
+
+ /**
+ * The object implements the readExternal method to restore its
+ * contents by calling the methods of DataInput for primitive
+ * types and readObject for objects, strings and arrays. The
+ * readExternal method must read the values in the same sequence
+ * and with the same types as were written by writeExternal.
+ *
+ * @param in the stream to read data from in order to restore the object
+ * @exception IOException if I/O errors occur
+ * @exception ClassNotFoundException If the class for an object being
+ * restored cannot be found.
+ */
+ public void readExternal( ObjectInput in ) throws IOException,
ClassNotFoundException
+ {
+ m_uid = (UID) in.readObject();
+ }
+
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/SameVMReply.java
Index: SameVMReply.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.common;
/**
* Class SameVMReply
*
*
* @author Paul Hammant <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public final class SameVMReply extends AltrmiReply
{
static final long serialVersionUID = -3567039115479930599L;
/**
* Constructor a SameVMReply
*
*/
public SameVMReply()
{
}
/**
* Gets number that represents type for this class.
* This is quicker than instanceof for type checking.
*
* @return the representative code
* @see AltrmiReplyConstants
*
*/
public int getReplyCode()
{
return AltrmiReplyConstants.SAMEVMREPLY;
}
}
1.8 +11 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java
Index: AbstractServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/AbstractServer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractServer.java 21 Sep 2002 15:52:56 -0000 1.7
+++ AbstractServer.java 13 Oct 2002 11:54:26 -0000 1.8
@@ -294,6 +294,16 @@
}
/**
+ * Get the Invocation Handler Adapter.
+ * @return the invocation handler adapter.
+ */
+ public InvocationHandlerAdapter getInovcationHandlerAdapter()
+ {
+ return m_inovcationHandlerAdapter;
+ }
+
+
+ /**
* Set the state for the server
* @param state The state
*/
1.9 +46 -34
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java
Index: InvocationHandlerAdapter.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/InvocationHandlerAdapter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- InvocationHandlerAdapter.java 26 Sep 2002 06:23:54 -0000 1.8
+++ InvocationHandlerAdapter.java 13 Oct 2002 11:54:26 -0000 1.9
@@ -10,32 +10,9 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
-import org.apache.excalibur.altrmi.common.AltrmiAuthenticationException;
-import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
-import org.apache.excalibur.altrmi.common.AltrmiInvocationHandler;
-import org.apache.excalibur.altrmi.common.AltrmiReply;
-import org.apache.excalibur.altrmi.common.AltrmiRequest;
-import org.apache.excalibur.altrmi.common.ClassReply;
-import org.apache.excalibur.altrmi.common.ClassRequest;
-import org.apache.excalibur.altrmi.common.ClassRetrievalFailedReply;
-import org.apache.excalibur.altrmi.common.ExceptionReply;
-import org.apache.excalibur.altrmi.common.GarbageCollectionReply;
-import org.apache.excalibur.altrmi.common.GarbageCollectionRequest;
-import org.apache.excalibur.altrmi.common.ListReply;
-import org.apache.excalibur.altrmi.common.LookupReply;
-import org.apache.excalibur.altrmi.common.LookupRequest;
-import org.apache.excalibur.altrmi.common.MethodFacadeArrayReply;
-import org.apache.excalibur.altrmi.common.MethodFacadeReply;
-import org.apache.excalibur.altrmi.common.MethodFacadeRequest;
-import org.apache.excalibur.altrmi.common.MethodReply;
-import org.apache.excalibur.altrmi.common.MethodRequest;
-import org.apache.excalibur.altrmi.common.NotPublishedReply;
-import org.apache.excalibur.altrmi.common.OpenConnectionReply;
-import org.apache.excalibur.altrmi.common.PingReply;
-import org.apache.excalibur.altrmi.common.RequestFailedReply;
-import org.apache.excalibur.altrmi.common.SuspendedReply;
-import org.apache.excalibur.altrmi.common.AltrmiRequestConstants;
-import org.apache.excalibur.altrmi.common.AltrmiReplyConstants;
+import java.rmi.server.UID;
+
+
import org.apache.excalibur.altrmi.server.AltrmiAuthenticator;
import org.apache.excalibur.altrmi.server.ClassRetrievalException;
import org.apache.excalibur.altrmi.server.ClassRetriever;
@@ -43,6 +20,34 @@
import org.apache.excalibur.altrmi.server.impl.AltrmiSession;
import org.apache.excalibur.altrmi.server.impl.DefaultAuthenticator;
import
org.apache.excalibur.altrmi.server.impl.classretrievers.NoClassRetriever;
+import org.apache.excalibur.altrmi.common.AltrmiInvocationHandler;
+import org.apache.excalibur.altrmi.common.AltrmiReply;
+import org.apache.excalibur.altrmi.common.AltrmiRequest;
+import org.apache.excalibur.altrmi.common.SuspendedReply;
+import org.apache.excalibur.altrmi.common.AltrmiRequestConstants;
+import org.apache.excalibur.altrmi.common.OpenConnectionRequest;
+import org.apache.excalibur.altrmi.common.PingReply;
+import org.apache.excalibur.altrmi.common.RequestFailedReply;
+import org.apache.excalibur.altrmi.common.MethodFacadeRequest;
+import org.apache.excalibur.altrmi.common.NotPublishedReply;
+import org.apache.excalibur.altrmi.common.ExceptionReply;
+import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
+import org.apache.excalibur.altrmi.common.AltrmiReplyConstants;
+import org.apache.excalibur.altrmi.common.MethodReply;
+import org.apache.excalibur.altrmi.common.MethodFacadeReply;
+import org.apache.excalibur.altrmi.common.MethodFacadeArrayReply;
+import org.apache.excalibur.altrmi.common.MethodRequest;
+import org.apache.excalibur.altrmi.common.LookupRequest;
+import org.apache.excalibur.altrmi.common.AltrmiAuthenticationException;
+import org.apache.excalibur.altrmi.common.LookupReply;
+import org.apache.excalibur.altrmi.common.ClassRequest;
+import org.apache.excalibur.altrmi.common.ClassReply;
+import org.apache.excalibur.altrmi.common.ClassRetrievalFailedReply;
+import org.apache.excalibur.altrmi.common.SameVMReply;
+import org.apache.excalibur.altrmi.common.OpenConnectionReply;
+import org.apache.excalibur.altrmi.common.ListReply;
+import org.apache.excalibur.altrmi.common.GarbageCollectionRequest;
+import org.apache.excalibur.altrmi.common.GarbageCollectionReply;
/**
* Class InvocationHandlerAdapter
@@ -56,6 +61,7 @@
{
private static int SESSION = 0;
+ private static final UID U_ID = new UID((short)20729);
private Long m_lastSession = new Long( 0 );
private HashMap m_sessions = new HashMap();
private boolean m_suspend = false;
@@ -132,7 +138,8 @@
}
else if( request.getRequestCode() ==
AltrmiRequestConstants.OPENCONNECTIONREQUEST )
{
- return doOpenConnectionRequest();
+ OpenConnectionRequest openConnectionRequest =
(OpenConnectionRequest) request;
+ return
doOpenConnectionRequest(openConnectionRequest.getMachineID());
}
else if( request.getRequestCode() ==
AltrmiRequestConstants.PINGREQUEST )
@@ -380,13 +387,18 @@
* Do an OpenConnection request
* @return The reply.
*/
- private AltrmiReply doOpenConnectionRequest()
+ private AltrmiReply doOpenConnectionRequest(UID machineID)
{
- Long session = getNewSession();
-
- m_sessions.put( session, new AltrmiSession( session ) );
-
- return new OpenConnectionReply(
m_altrmiAuthenticator.getTextToSign(), session );
+ if (machineID != null && machineID.equals(U_ID))
+ {
+ return new SameVMReply();
+ }
+ else
+ {
+ Long session = getNewSession();
+ m_sessions.put( session, new AltrmiSession( session ) );
+ return new OpenConnectionReply(
m_altrmiAuthenticator.getTextToSign(), session );
+ }
}
/**
1.6 +6 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/CallbackServerClassAltrmiFactory.java
Index: CallbackServerClassAltrmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/CallbackServerClassAltrmiFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CallbackServerClassAltrmiFactory.java 26 Sep 2002 06:23:54 -0000
1.5
+++ CallbackServerClassAltrmiFactory.java 13 Oct 2002 11:54:27 -0000
1.6
@@ -57,7 +57,7 @@
*/
public void setInitializedHostContext( AltrmiHostContext hostContext )
{
- mHostContext = (AbstractHostContext)hostContext;
+ m_hostContext = (AbstractHostContext)hostContext;
}
/**
@@ -79,9 +79,9 @@
String modifiedPublishedName =
publishedServiceName.substring( 0,
publishedServiceName.lastIndexOf( "_" ) );
AltrmiReply ar =
- mHostContext.getClientInvocationHandler()
+ m_hostContext.getClientInvocationHandler()
.handleInvocation( new LookupRequest( modifiedPublishedName,
altrmiAuthentication,
- mSession ) );
+ m_session ) );
if( ar.getReplyCode() >= AltrmiReplyConstants.PROBLEMREPLY )
{
@@ -104,9 +104,9 @@
LookupReply lr = (LookupReply)ar;
DefaultProxyHelper baseObj = new DefaultProxyHelper(
- this, mHostContext.getClientInvocationHandler(),
+ this, m_hostContext.getClientInvocationHandler(),
publishedServiceName, "Main",
- lr.getReferenceID(), mSession );
+ lr.getReferenceID(), m_session );
Object retVal = getInstance( modifiedPublishedName, "Main", baseObj,
isBeanOnly() );
baseObj.registerImplObject( retVal );
1.5 +16 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java
Index: AbstractPipedServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/AbstractPipedServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractPipedServer.java 21 Sep 2002 15:52:57 -0000 1.4
+++ AbstractPipedServer.java 13 Oct 2002 11:54:27 -0000 1.5
@@ -13,6 +13,7 @@
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.server.impl.AbstractServer;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
+import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
/**
* Class AbstractPipedServer
@@ -23,6 +24,20 @@
*/
public abstract class AbstractPipedServer extends AbstractServer
{
+
+ /**
+ * Construct a Piped Server with no prexisting InvocationHandlerAdapter.
+ */
+ public AbstractPipedServer() {
+ }
+
+ /**
+ * Construct a Piped Server with a prexisting InvocationHandlerAdapter.
+ * @param inovcationHandlerAdapter the invocation handler adapter.
+ */
+ public AbstractPipedServer(InvocationHandlerAdapter
inovcationHandlerAdapter) {
+ super(inovcationHandlerAdapter);
+ }
/**
* Method connect
1.2 +16 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedCustomStreamServer.java
Index: PipedCustomStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedCustomStreamServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PipedCustomStreamServer.java 24 Aug 2002 10:05:52 -0000 1.1
+++ PipedCustomStreamServer.java 13 Oct 2002 11:54:27 -0000 1.2
@@ -9,6 +9,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
+import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
/**
* Class PipedCustomStreamServer
@@ -19,6 +20,20 @@
*/
public class PipedCustomStreamServer extends AbstractPipedServer
{
+
+ /**
+ * Construct a Piped Custom Server with no prexisting
InvocationHandlerAdapter.
+ */
+ public PipedCustomStreamServer() {
+ }
+
+ /**
+ * Construct a Piped Custom Server with a prexisting
InvocationHandlerAdapter.
+ * @param inovcationHandlerAdapter the invocation handler adapter.
+ */
+ public PipedCustomStreamServer(InvocationHandlerAdapter
inovcationHandlerAdapter) {
+ super(inovcationHandlerAdapter);
+ }
protected ServerStreamReadWriter createServerStreamReadWriter()
{
1.4 +17 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedObjectStreamServer.java
Index: PipedObjectStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/piped/PipedObjectStreamServer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PipedObjectStreamServer.java 24 Aug 2002 10:05:52 -0000 1.3
+++ PipedObjectStreamServer.java 13 Oct 2002 11:54:27 -0000 1.4
@@ -9,6 +9,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerObjectStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
+import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
/**
* Class PipedObjectStreamServer
@@ -19,6 +20,21 @@
*/
public class PipedObjectStreamServer extends AbstractPipedServer
{
+
+ /**
+ * Construct a Piped Object Server with no prexisting
InvocationHandlerAdapter.
+ */
+ public PipedObjectStreamServer() {
+ }
+
+ /**
+ * Construct a Piped Object Server with a prexisting
InvocationHandlerAdapter.
+ * @param inovcationHandlerAdapter the invocation handler adapter.
+ */
+
+ public PipedObjectStreamServer(InvocationHandlerAdapter
inovcationHandlerAdapter) {
+ super(inovcationHandlerAdapter);
+ }
protected ServerStreamReadWriter createServerStreamReadWriter()
{
1.7 +3 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java
Index: AbstractCompleteSocketStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractCompleteSocketStreamServer.java 21 Sep 2002 15:52:57 -0000
1.6
+++ AbstractCompleteSocketStreamServer.java 13 Oct 2002 11:54:27 -0000
1.7
@@ -15,6 +15,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
+
/**
* Class CompleteSocketObjectStreamServer
*
@@ -51,6 +52,7 @@
try
{
m_serverSocket = new ServerSocket( port );
+
}
catch( IOException ioe )
{
1.5 +2 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java
Index: AbstractPartialSocketStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractPartialSocketStreamServer.java 21 Sep 2002 15:52:57 -0000
1.4
+++ AbstractPartialSocketStreamServer.java 13 Oct 2002 11:54:27 -0000
1.5
@@ -13,6 +13,7 @@
*/
public abstract class AbstractPartialSocketStreamServer extends
AbstractServer
{
+
/**
* Construct an AbstractPartialSocketStreamServer
*/
1.4 +7 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamServer.java
Index: CompleteSocketCustomStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamServer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CompleteSocketCustomStreamServer.java 21 Sep 2002 15:52:57 -0000
1.3
+++ CompleteSocketCustomStreamServer.java 13 Oct 2002 11:54:27 -0000
1.4
@@ -11,6 +11,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
+import org.apache.excalibur.altrmi.registry.Registry;
/**
* Class CompleteSocketObjectStreamServer
@@ -21,6 +22,7 @@
*/
public class CompleteSocketCustomStreamServer extends
AbstractCompleteSocketStreamServer
{
+ private int m_port;
/**
* Construct a CompleteSocketObjectStreamServer
@@ -34,6 +36,8 @@
public CompleteSocketCustomStreamServer( int port ) throws
AltrmiServerException
{
super( port );
+ Registry.getInstance().put("/.altrmi/optimizations/port=" + port,
+ new
CompleteSocketCustomStreamPipedBinder(super.getInovcationHandlerAdapter()));
}
/**
@@ -50,6 +54,8 @@
throws AltrmiServerException
{
super( invocationHandlerAdapter, port );
+ Registry.getInstance().put("/.altrmi/optimizations/port=" + port,
+ new
CompleteSocketCustomStreamPipedBinder(invocationHandlerAdapter));
}
/**
1.5 +22 -5
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java
Index: PartialSocketCustomStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PartialSocketCustomStreamServer.java 21 Sep 2002 15:52:57 -0000
1.4
+++ PartialSocketCustomStreamServer.java 13 Oct 2002 11:54:27 -0000
1.5
@@ -10,6 +10,8 @@
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
+import org.apache.excalibur.altrmi.server.AltrmiServerException;
+import org.apache.excalibur.altrmi.registry.Registry;
/**
* Class PartialSocketCustomStreamServer
@@ -22,14 +24,29 @@
public class PartialSocketCustomStreamServer extends
AbstractPartialSocketStreamServer
{
+ private CompleteSocketCustomStreamPipedBinder
m_completeSocketCustomStreamPipedBinder;
+
/**
* Construct a PartialSocketCustomStreamServer
- *
- *
- *
+ * @param port the port for the socketserver.
+ * @throws AltrmiServerException if a problem
+ */
+ public PartialSocketCustomStreamServer(int port) throws
AltrmiServerException
+ {
+
+ m_completeSocketCustomStreamPipedBinder =
+ new
CompleteSocketCustomStreamPipedBinder(super.getInovcationHandlerAdapter());
+ Registry.getInstance().put("/.altrmi/optimizations/port="
+ + port, m_completeSocketCustomStreamPipedBinder);
+ }
+
+ /**
+ * Stop
*/
- public PartialSocketCustomStreamServer()
+ public void stop()
{
+ super.stop();
+ m_completeSocketCustomStreamPipedBinder.stop();
}
/**
1.5 +23 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java
Index: PartialSocketObjectStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PartialSocketObjectStreamServer.java 21 Sep 2002 15:52:57 -0000
1.4
+++ PartialSocketObjectStreamServer.java 13 Oct 2002 11:54:27 -0000
1.5
@@ -10,6 +10,9 @@
import org.apache.excalibur.altrmi.server.impl.ServerObjectStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
+import org.apache.excalibur.altrmi.server.AltrmiServerException;
+import org.apache.excalibur.altrmi.registry.Registry;
+
/**
* Class PartialSocketObjectStreamServer
@@ -22,13 +25,31 @@
public class PartialSocketObjectStreamServer extends
AbstractPartialSocketStreamServer
{
+ private CompleteSocketObjectStreamPipedBinder
m_completeSocketObjectStreamPipedBinder;
+
/**
* Construct a PartialSocketObjectStreamServer
*
+ * @param port the port
+ * @throws AltrmiServerException if a problem
+ */
+ public PartialSocketObjectStreamServer(int port) throws
AltrmiServerException
+ {
+ m_completeSocketObjectStreamPipedBinder =
+ new
CompleteSocketObjectStreamPipedBinder(super.getInovcationHandlerAdapter());
+ Registry.getInstance().put("/.altrmi/optimizations/port="
+ + port, m_completeSocketObjectStreamPipedBinder);
+ }
+
+ /**
+ * Stop
*/
- public PartialSocketObjectStreamServer()
+ public void stop()
{
+ super.stop();
+ m_completeSocketObjectStreamPipedBinder.stop();
}
+
/**
* Construct a PartialSocketObjectStreamServer
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedBinder.java
Index: CompleteSocketCustomStreamPipedBinder.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.server.impl.socket;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.registry.Binder;
import org.apache.excalibur.altrmi.registry.BindException;
import org.apache.excalibur.altrmi.registry.Bound;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import java.util.Vector;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
/**
* A Complete Socket Custom Stream Piped Binder
* @author Paul Hammant
*/
public class CompleteSocketCustomStreamPipedBinder implements Binder
{
private InvocationHandlerAdapter m_invocationHandlerAdapter;
private Vector m_connections = new Vector();
/**
* Construuct a Piped Binder
* @param invocationHandlerAdapter An invocation handler adapter to
handle requests
*/
public CompleteSocketCustomStreamPipedBinder(InvocationHandlerAdapter
invocationHandlerAdapter)
{
m_invocationHandlerAdapter = invocationHandlerAdapter;
}
/**
* Bind to an piped stream
* @param bindParms the piped input stream and piped output stream
* @return thebound object
* @throws BindException if a problem
*/
public Bound bind(Object[] bindParms) throws BindException
{
PipedInputStream inputStream = (PipedInputStream) bindParms[0];
PipedOutputStream outputStream = (PipedOutputStream) bindParms[1];
try
{
Bound connection =
new
CompleteSocketCustomStreamPipedConnection(m_invocationHandlerAdapter,
this, inputStream, outputStream);
m_connections.add(connection);
return connection;
}
catch (AltrmiConnectionException e)
{
throw new BindException("Problem binding: " + e.getMessage());
}
}
/**
* Stop the server
*/
public void stop()
{
for (int i = 0; i < m_connections.size(); i++)
{
CompleteSocketCustomStreamPipedConnection
completeSocketCustomStreamPipedConnection =
(CompleteSocketCustomStreamPipedConnection)
m_connections.elementAt(i);
completeSocketCustomStreamPipedConnection.stop();
}
}
/**
* End a connection
* @param connection the connection
*/
void endConnection(CompleteSocketCustomStreamPipedConnection connection)
{
for (int i = 0; i < m_connections.size(); i++)
{
CompleteSocketCustomStreamPipedConnection
completeSocketCustomStreamPipedConnection =
(CompleteSocketCustomStreamPipedConnection)
m_connections.elementAt(i);
if (connection == completeSocketCustomStreamPipedConnection)
{
connection.stop();
}
}
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedConnection.java
Index: CompleteSocketCustomStreamPipedConnection.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.server.impl.socket;
import org.apache.excalibur.altrmi.server.impl.piped.PipedCustomStreamServer;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.registry.Bound;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
/**
* A Complete Sockect Custom Stream Piped Instance.
* @author Paul Hammant
*/
public class CompleteSocketCustomStreamPipedConnection implements Bound
{
private PipedCustomStreamServer m_pipedCustomStreamServer;
private CompleteSocketCustomStreamPipedBinder
m_completeSocketCustomStreamPipedBinder;
/**
* Create a Complete Socket CustomStream Piped Connection
* @param invocationHandlerAdapter the invocation adapter from the
SocketCustomStream
* @param completeSocketCustomStreamPipedBinder The binder that controls
this connection
* @param inputStream the piped input stream
* @param outputStream the piped output stream
* @throws AltrmiConnectionException if a problem
*/
public CompleteSocketCustomStreamPipedConnection
(
InvocationHandlerAdapter invocationHandlerAdapter,
CompleteSocketCustomStreamPipedBinder
completeSocketCustomStreamPipedBinder,
PipedInputStream inputStream,
PipedOutputStream outputStream) throws AltrmiConnectionException
{
m_pipedCustomStreamServer = new
PipedCustomStreamServer(invocationHandlerAdapter);
m_pipedCustomStreamServer.start();
m_completeSocketCustomStreamPipedBinder =
completeSocketCustomStreamPipedBinder;
m_pipedCustomStreamServer.makeNewConnection(inputStream,
outputStream);
}
/**
* Close the connection
*/
public void close()
{
m_completeSocketCustomStreamPipedBinder.endConnection(this);
}
/**
* Stop the server.
*/
protected void stop()
{
m_pipedCustomStreamServer.stop();
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedBinder.java
Index: CompleteSocketObjectStreamPipedBinder.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.server.impl.socket;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.registry.Binder;
import org.apache.excalibur.altrmi.registry.BindException;
import org.apache.excalibur.altrmi.registry.Bound;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import java.util.Vector;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
/**
* A Complete Socket Object Stream Piped Binder
* @author Paul Hammant
*/
public class CompleteSocketObjectStreamPipedBinder implements Binder
{
private InvocationHandlerAdapter m_invocationHandlerAdapter;
private Vector m_connections = new Vector();
/**
* Construuct a Piped Binder
* @param invocationHandlerAdapter An invocation handler adapter to
handle requests
*/
public CompleteSocketObjectStreamPipedBinder(InvocationHandlerAdapter
invocationHandlerAdapter)
{
m_invocationHandlerAdapter = invocationHandlerAdapter;
}
/**
* Bind to an piped stream
* @param bindParms the piped input stream and piped output stream
* @return thebound object
* @throws BindException if a problem
*/
public Bound bind(Object[] bindParms) throws BindException
{
PipedInputStream inputStream = (PipedInputStream) bindParms[0];
PipedOutputStream outputStream = (PipedOutputStream) bindParms[1];
try
{
Bound connection =
new
CompleteSocketObjectStreamPipedConnection(m_invocationHandlerAdapter,
this, inputStream, outputStream);
m_connections.add(connection);
return connection;
}
catch (AltrmiConnectionException e)
{
throw new BindException("Problem binding: " + e.getMessage());
}
}
/**
* Stop the server
*/
public void stop()
{
for (int i = 0; i < m_connections.size(); i++)
{
CompleteSocketObjectStreamPipedConnection
completeSocketObjectStreamPipedConnection =
(CompleteSocketObjectStreamPipedConnection)
m_connections.elementAt(i);
completeSocketObjectStreamPipedConnection.stop();
}
}
/**
* End a connection
* @param connection the connection
*/
void endConnection(CompleteSocketObjectStreamPipedConnection connection)
{
for (int i = 0; i < m_connections.size(); i++)
{
CompleteSocketObjectStreamPipedConnection
completeSocketObjectStreamPipedConnection =
(CompleteSocketObjectStreamPipedConnection)
m_connections.elementAt(i);
if (connection == completeSocketObjectStreamPipedConnection)
{
connection.stop();
}
}
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedConnection.java
Index: CompleteSocketObjectStreamPipedConnection.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.server.impl.socket;
import org.apache.excalibur.altrmi.server.impl.piped.PipedObjectStreamServer;
import
org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.registry.Bound;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
/**
* A Complete Sockect Object Stream Piped Connection.
* @author Paul Hammant
*/
public class CompleteSocketObjectStreamPipedConnection implements Bound
{
private PipedObjectStreamServer m_pipedObjectStreamServer;
private CompleteSocketObjectStreamPipedBinder
m_completeSocketObjectStreamPipedBinder;
/**
* Create a Complete Socket ObjectStream Piped Connection
* @param invocationHandlerAdapter the invocation adapter from the
SocketObjectStream
* @param completeSocketObjectStreamPipedBinder The binder that controls
this connection
* @param inputStream the piped input stream
* @param outputStream the piped output stream
* @throws AltrmiConnectionException if a problem
*/
public CompleteSocketObjectStreamPipedConnection
(
InvocationHandlerAdapter invocationHandlerAdapter,
CompleteSocketObjectStreamPipedBinder
completeSocketObjectStreamPipedBinder,
PipedInputStream inputStream,
PipedOutputStream outputStream) throws AltrmiConnectionException
{
m_pipedObjectStreamServer = new
PipedObjectStreamServer(invocationHandlerAdapter);
m_completeSocketObjectStreamPipedBinder =
completeSocketObjectStreamPipedBinder;
m_pipedObjectStreamServer.makeNewConnection(inputStream,
outputStream);
m_pipedObjectStreamServer.start();
}
/**
* Close the connection
*/
public void close()
{
m_completeSocketObjectStreamPipedBinder.endConnection(this);
}
/**
* Stop the server.
*/
protected void stop()
{
m_pipedObjectStreamServer.stop();
}
}
1.5 +2 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CallbackEnabledCustomStreamTestCase.java
Index: CallbackEnabledCustomStreamTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CallbackEnabledCustomStreamTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CallbackEnabledCustomStreamTestCase.java 26 Aug 2002 21:53:49 -0000
1.4
+++ CallbackEnabledCustomStreamTestCase.java 13 Oct 2002 11:54:28 -0000
1.5
@@ -47,7 +47,8 @@
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
- altrmiFactory.setHostContext(new
CallbackEnabledSocketCustomStreamHostContext("127.0.0.1", 10004));
+ altrmiFactory.setHostContext(
+ new
CallbackEnabledSocketCustomStreamHostContext("127.0.0.1", 10004), false);
testClient = (TestInterface) altrmiFactory.lookup("Hello");
// just a kludge for unit testing given we are intrinsically dealing
with
1.5 +1 -0
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamJNDITestCase.java
Index: CustomStreamJNDITestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamJNDITestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CustomStreamJNDITestCase.java 26 Aug 2002 10:44:08 -0000 1.4
+++ CustomStreamJNDITestCase.java 13 Oct 2002 11:54:28 -0000 1.5
@@ -56,6 +56,7 @@
env.put( Context.PROVIDER_URL,
"altrmi://localhost:10006/SocketCustomStream" );
env.put( "proxy.type", "ClientSideClasses" );
env.put( "bean.type", "NotBeanOnly" );
+ env.put( "optimize", "false" );
jndiContext = new InitialContext( env );
1.4 +1 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamTestCase.java
Index: CustomStreamTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CustomStreamTestCase.java 26 Aug 2002 10:44:08 -0000 1.3
+++ CustomStreamTestCase.java 13 Oct 2002 11:54:28 -0000 1.4
@@ -46,7 +46,7 @@
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
- altrmiFactory.setHostContext(new
SocketCustomStreamHostContext("127.0.0.1", 10001));
+ altrmiFactory.setHostContext(new
SocketCustomStreamHostContext("127.0.0.1", 10001), false);
testClient = (TestInterface) altrmiFactory.lookup("Hello");
// just a kludge for unit testing given we are intrinsically dealing
with
1.4 +2 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/JSXObjectStreamTestCase.java
Index: JSXObjectStreamTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/JSXObjectStreamTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JSXObjectStreamTestCase.java 26 Aug 2002 10:44:08 -0000 1.3
+++ JSXObjectStreamTestCase.java 13 Oct 2002 11:54:28 -0000 1.4
@@ -47,7 +47,8 @@
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
- altrmiFactory.setHostContext(new
SocketObjectStreamHostContext("127.0.0.1", 10009, "JSX.ObjIn", "JSX.ObjOut"));
+ altrmiFactory.setHostContext(
+ new SocketObjectStreamHostContext("127.0.0.1", 10009,
"JSX.ObjIn", "JSX.ObjOut"), false);
testClient = (TestInterface) altrmiFactory.lookup("Hello");
// just a kludge for unit testing given we are intrinsically dealing
with
1.5 +1 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/ObjectStreamTestCase.java
Index: ObjectStreamTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/ObjectStreamTestCase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ObjectStreamTestCase.java 26 Aug 2002 13:59:52 -0000 1.4
+++ ObjectStreamTestCase.java 13 Oct 2002 11:54:28 -0000 1.5
@@ -54,7 +54,7 @@
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
- altrmiFactory.setHostContext(new
SocketObjectStreamHostContext("127.0.0.1", 10002));
+ altrmiFactory.setHostContext(new
SocketObjectStreamHostContext("127.0.0.1", 10002), false);
testClient = (TestInterface) altrmiFactory.lookup("Hello");
// just a kludge for unit testing given we are intrinsically dealing
with
1.1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/socket/CustomStreamOptmizedTestCase.java
Index: CustomStreamOptmizedTestCase.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.test.socket;
import
org.apache.excalibur.altrmi.client.impl.socket.SocketCustomStreamHostContext;
import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
import
org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
import org.apache.excalibur.altrmi.server.PublicationDescription;
import org.apache.excalibur.altrmi.test.TestInterface;
import org.apache.excalibur.altrmi.test.AbstractHelloTestCase;
import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
import org.apache.excalibur.altrmi.test.TestInterface3;
import org.apache.excalibur.altrmi.test.TestInterface2;
/**
* Test Custom Stream over sockets with optmization
* @author Paul Hammant
*/
public class CustomStreamOptmizedTestCase extends AbstractHelloTestCase
{
public CustomStreamOptmizedTestCase(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
// server side setup.
server = new CompleteSocketCustomStreamServer(10001);
testServer = new TestInterfaceImpl();
PublicationDescription pd = new
PublicationDescription(TestInterface.class,
new Class[] { TestInterface3.class, TestInterface2.class });
server.publish(testServer, "Hello", pd);
server.start();
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
altrmiFactory.setHostContext(new
SocketCustomStreamHostContext("127.0.0.1", 10001), true);
testClient = (TestInterface) altrmiFactory.lookup("Hello");
// just a kludge for unit testing given we are intrinsically dealing
with
// threads, AltRMI being a client/server thing
Thread.yield();
}
protected void tearDown() throws Exception
{
testClient = null;
System.gc();
Thread.yield();
altrmiFactory.close();
Thread.yield();
server.stop();
Thread.yield();
server = null;
testServer = null;
super.tearDown();
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>