hammant 2003/01/05 14:05:03
Modified: altrmi/src/java/org/apache/excalibur/altrmi/client/impl
AbstractClientInvocationHandler.java
AbstractConnectionPinger.java
DefaultConnectionListener.java
DefaultProxyHelper.java
altrmi/src/java/org/apache/excalibur/altrmi/common
AltrmiReplyConstants.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl
DefaultMethodInvocationHandler.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters
InvocationHandlerAdapter.java
PublicationAdapter.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket
CallbackEnabledSocketCustomStreamReadWriter.java
altrmi/src/test/org/apache/excalibur/altrmi/client/impl
DummyInvocationHandler.java
altrmi/src/test/org/apache/excalibur/altrmi/test/callback
CallBackTestImpl.java
Added: altrmi/src/java/org/apache/excalibur/altrmi/client/impl
DumbConnectionListener.java
NeverConnectionPinger.java
altrmi/src/java/org/apache/excalibur/altrmi/common
NoSuchSessionException.java
altrmi/src/java/org/apache/excalibur/altrmi/client
AltrmiConnectionClosedException.java
altrmi/src/test/org/apache/excalibur/altrmi/test/hackers
BouncingServerTestCase.java
Removed: altrmi/src/java/org/apache/excalibur/altrmi/common
AltrmiConnectionClosedException.java
Log:
Server bounce now passed on to clients. Tested for too.
Revision Changes Path
1.7 +6 -6
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractClientInvocationHandler.java
Index: AbstractClientInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractClientInvocationHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractClientInvocationHandler.java 4 Jan 2003 22:17:18 -0000 1.6
+++ AbstractClientInvocationHandler.java 5 Jan 2003 22:05:01 -0000 1.7
@@ -13,7 +13,7 @@
import org.apache.excalibur.altrmi.client.AltrmiConnectionListener;
import org.apache.excalibur.altrmi.client.AltrmiConnectionPinger;
import org.apache.excalibur.altrmi.client.AltrmiProxy;
-import org.apache.excalibur.altrmi.common.AltrmiConnectionClosedException;
+import org.apache.excalibur.altrmi.client.AltrmiConnectionClosedException;
import org.apache.excalibur.altrmi.common.AltrmiInvocationHandler;
import org.apache.excalibur.altrmi.common.AltrmiReply;
import org.apache.excalibur.altrmi.common.FacadeRefHolder;
@@ -28,7 +28,7 @@
* @version $Revision$
*/
public abstract class AbstractClientInvocationHandler
- implements AltrmiInvocationHandler, AltrmiClientInvocationHandler
+ implements AltrmiClientInvocationHandler
{
protected AltrmiConnectionPinger m_connectionPinger;
@@ -121,8 +121,8 @@
{
return AbstractClientInvocationHandler.class.getClassLoader();
}
-
-
+
+
/**
* resolveArgument can handle any changes that one has to do to the arguments
being
* marshalled to the server.
@@ -135,5 +135,5 @@
public Object resolveArgument(String methodSignature ,Class objClass , Object
obj)
{
return obj;
- }
+ }
}
1.9 +2 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractConnectionPinger.java
Index: AbstractConnectionPinger.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractConnectionPinger.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractConnectionPinger.java 4 Jan 2003 21:31:45 -0000 1.8
+++ AbstractConnectionPinger.java 5 Jan 2003 22:05:01 -0000 1.9
@@ -9,7 +9,7 @@
import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
import org.apache.excalibur.altrmi.client.AltrmiConnectionPinger;
-import org.apache.excalibur.altrmi.common.AltrmiConnectionClosedException;
+import org.apache.excalibur.altrmi.client.AltrmiConnectionClosedException;
import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
/**
1.6 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultConnectionListener.java
Index: DefaultConnectionListener.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultConnectionListener.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultConnectionListener.java 21 Dec 2002 21:43:54 -0000 1.5
+++ DefaultConnectionListener.java 5 Jan 2003 22:05:01 -0000 1.6
@@ -14,10 +14,10 @@
import java.io.IOException;
/**
- * Interface AltrmiConnectionListener
+ * Interface DefaultConnectionListener
*
*
- * @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
+ * @author Paul Hammant
* @version * $Revision$
*/
public class DefaultConnectionListener implements AltrmiConnectionListener
1.16 +19 -44
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java
Index: DefaultProxyHelper.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DefaultProxyHelper.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DefaultProxyHelper.java 26 Nov 2002 06:09:55 -0000 1.15
+++ DefaultProxyHelper.java 5 Jan 2003 22:05:01 -0000 1.16
@@ -210,16 +210,9 @@
return implBeans;
}
- else if( reply.getReplyCode() == AltrmiReplyConstants.EXCEPTIONREPLY )
- {
- ExceptionReply er = (ExceptionReply)reply;
-
- throw er.getReplyException();
- }
else
{
- throw new AltrmiInvocationException( "Internal Error : Unknown reply
type :"
- + reply.getClass().getName() );
+ throw makeUnexpectedReplyThrowable(reply);
}
}
@@ -250,16 +243,9 @@
return or.getReplyObject();
}
- else if( reply.getReplyCode() == AltrmiReplyConstants.EXCEPTIONREPLY )
- {
- ExceptionReply er = (ExceptionReply)reply;
-
- throw er.getReplyException();
- }
else
{
- throw new AltrmiInvocationException( "Internal Error : Unknown reply
type :"
- + reply.getClass().getName() );
+ throw makeUnexpectedReplyThrowable(reply);
}
}
@@ -277,19 +263,11 @@
if( reply.getReplyCode() == AltrmiReplyConstants.METHODREPLY )
{
MethodReply or = (MethodReply)reply;
-
return;
}
- else if( reply.getReplyCode() == AltrmiReplyConstants.EXCEPTIONREPLY )
- {
- ExceptionReply er = (ExceptionReply)reply;
-
- throw er.getReplyException();
- }
else
{
- throw new AltrmiInvocationException( "Internal Error : Unknown reply
type :"
- + reply.getClass().getName() );
+ throw makeUnexpectedReplyThrowable(reply);
}
}
@@ -318,16 +296,9 @@
return;
}
- else if( reply.getReplyCode() == AltrmiReplyConstants.EXCEPTIONREPLY )
- {
- ExceptionReply er = (ExceptionReply)reply;
-
- throw er.getReplyException();
- }
else
{
- throw new AltrmiInvocationException( "Internal Error : Unknown reply
type :"
- + reply.getClass().getName() );
+ throw makeUnexpectedReplyThrowable(reply);
}
}
@@ -363,21 +334,25 @@
processVoidRequest( methodSignature, newArgs );
}
-
- private void debug( Object[] args )
- {
+ /**
+ *
+ * @param reply The reply that represents the unexpected reply.
+ * @return The exception that is pertient.
+ */
+ private Throwable makeUnexpectedReplyThrowable(AltrmiReply reply) {
- for( int i = 0; i < args.length; i++ )
+ if( reply.getReplyCode() == AltrmiReplyConstants.EXCEPTIONREPLY )
{
- Object arg = args[ i ];
-
- System.out.println( "i = " + i + " class= " + args[ i
].getClass().getName() + " "
- + args[ i ].toString() );
+ ExceptionReply er = (ExceptionReply)reply;
+ return er.getReplyException();
+ }
+ else
+ {
+ return new AltrmiInvocationException( "Internal Error : Unknown reply
type :"
+ + reply.getClass().getName() );
}
}
-
-
/**
* Method getReferenceID
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/DumbConnectionListener.java
Index: DumbConnectionListener.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.AltrmiConnectionListener;
import org.apache.excalibur.altrmi.common.AltrmiInvocationException;
import org.apache.excalibur.altrmi.common.AltrmiRequest;
import java.io.IOException;
/**
* Interface AltrmiConnectDumbConnectionListenerionListener
*
*
* @author Paul Hammant
* @version * $Revision: 1.1 $
*/
public class DumbConnectionListener implements AltrmiConnectionListener
{
/**
* Creates a new DumbConnectionListener.
*/
public DumbConnectionListener()
{
}
/**
* Method methodCalled
*
*
*
* @param methodSignature
* @param duration
*
*/
public void methodCalled( final String methodSignature, final long duration )
{
// do mothing in default impl, could do logging.
}
/**
* Method methodLogging tests if the implementing class intends to do method
logging.
*
*
* @return
*
*/
public boolean methodLogging()
{
return false;
}
/**
* Method serviceSuspended
*
*
*
* @param altrmiRequest
* @param attempt
* @param suggestedWaitMillis
*
*/
public void serviceSuspended( final AltrmiRequest altrmiRequest, final int
attempt,
final int suggestedWaitMillis )
{
}
/**
* Method serviceAbend
*
*
*
* @param attempt
*
*/
public void serviceAbend( int attempt, IOException cause )
{
throw new AltrmiInvocationException( "AltRMI Service has Abended." );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/NeverConnectionPinger.java
Index: NeverConnectionPinger.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.AltrmiConnectionPinger;
import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
/**
* Interface NeverConnectionPinger
*
*
* @author Paul Hammant
* @version * $Revision: 1.1 $
*/
public class NeverConnectionPinger implements AltrmiConnectionPinger
{
/**
* Implemnt the abstract ping() from the AbstractConnectionPinger
*/
protected void ping()
{
}
public void setAltrmiInvocationHandler(AltrmiClientInvocationHandler
altrmiInvocationHandler)
{
}
public void start()
{
}
public void stop()
{
}
}
1.5 +2 -2
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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AltrmiReplyConstants.java 24 Nov 2002 07:16:34 -0000 1.4
+++ AltrmiReplyConstants.java 5 Jan 2003 22:05:02 -0000 1.5
@@ -100,5 +100,5 @@
* The proxy class could not be retrieved.
*/
int CLASSRETRIEVALFAILEDREPLY = 107;
-
+
}
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/NoSuchSessionException.java
Index: NoSuchSessionException.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 NoSuchSessionException
*
*
* @author Paul Hammant
* @version $Revision: 1.1 $
*/
public class NoSuchSessionException extends AltrmiInvocationException
{
static final long serialVersionUID = -111L;
/**
* Constructor NoSuchSessionException
*
* @param sessionID the reference id
*
*/
public NoSuchSessionException( Long sessionID )
{
super( "There is no instance on the server mapped to sessionID " + sessionID
+
". The server may have been bounced since the client first did a
lookup.");
}
}
1.11 +17 -13
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/DefaultMethodInvocationHandler.java
Index: DefaultMethodInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/DefaultMethodInvocationHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultMethodInvocationHandler.java 4 Jan 2003 21:31:46 -0000 1.10
+++ DefaultMethodInvocationHandler.java 5 Jan 2003 22:05:02 -0000 1.11
@@ -53,7 +53,7 @@
/**
* Next reference
*/
- private static int c_nextReference = 1;
+ private static int c_nextReference = 0;
/**
* The altrmi publisher
@@ -162,17 +162,11 @@
public Long getOrMakeReferenceIDForBean( Object implBean )
{
- Long ref = (Long)m_beanRefs.get( implBean );
+ Long ref = (Long) m_beanRefs.get( implBean );
if( ref == null )
{
-
- //ref = new Long((long) ((long) mNextReference++ << 32)
- // + (long) Math.round(Math.random()));
- ref = new Long( c_nextReference++ );
-
- //m_beanRefs.put(implBean, ref);
- //m_refBeans.put(ref, implBean);
+ ref = getNewReference();
addImplementationBean( ref, implBean );
}
@@ -199,11 +193,11 @@
new AltrmiInvocationException( "Method not present in impl" ) );
}
- Method method = (Method)m_methodMap.get( methodSignature );
+ Method method = (Method) m_methodMap.get( methodSignature );
try
{
- WeakReference wr = (WeakReference)m_refBeans.get(
request.getReferenceID() );
+ WeakReference wr = (WeakReference) m_refBeans.get(
request.getReferenceID() );
if( wr == null )
{
@@ -313,5 +307,15 @@
String[] methodNames=(String[])m_methodMap.keySet().toArray(new String[0]);
return methodNames;
}
-
+
+ /**
+ * Get a new reference ID
+ * @return The reference
+ */
+ private Long getNewReference()
+ {
+ // approve everything and set session identifier.
+ return new Long((++ c_nextReference << 16) + ((long) (Math.random() *
65536)));
+ }
+
}
1.16 +60 -28
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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- InvocationHandlerAdapter.java 4 Jan 2003 21:31:46 -0000 1.15
+++ InvocationHandlerAdapter.java 5 Jan 2003 22:05:02 -0000 1.16
@@ -45,6 +45,7 @@
import org.apache.excalibur.altrmi.common.MethodNameHelper;
import org.apache.excalibur.altrmi.common.MethodAsyncRequest;
import org.apache.excalibur.altrmi.common.RawRequest;
+import org.apache.excalibur.altrmi.common.NoSuchSessionException;
import org.apache.excalibur.altrmi.server.AltrmiAuthenticator;
import org.apache.excalibur.altrmi.server.ClassRetrievalException;
import org.apache.excalibur.altrmi.server.ClassRetriever;
@@ -65,7 +66,7 @@
implements AltrmiInvocationHandler
{
- private static int c_session = 0;
+ private static long c_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();
@@ -118,6 +119,7 @@
// it is the one we want to be most speedy.
if( request.getRequestCode() == AltrmiRequestConstants.METHODREQUEST )
{
+
return doMethodRequest( request );
}
@@ -180,6 +182,12 @@
private AltrmiReply doMethodFacadeRequest( AltrmiRequest request )
{
MethodFacadeRequest facadeRequest = (MethodFacadeRequest)request;
+
+ if (!sessionExists(facadeRequest.getSession()))
+ {
+ return new ExceptionReply(new
NoSuchSessionException(facadeRequest.getSession()));
+ }
+
String publishedThing = facadeRequest.getPublishedServiceName() + "_"
+ facadeRequest.getObjectName();
@@ -188,11 +196,11 @@
return new NotPublishedReply();
}
- if( !sessionExists( facadeRequest.getSession() ) )
- {
- return new ExceptionReply(
- new AltrmiInvocationException( "TODO - you dirty rat/hacker" ) );
- }
+ //if( !sessionExists( facadeRequest.getSession() ) )
+ //{
+ // return new ExceptionReply(
+ // new AltrmiInvocationException( "TODO - you dirty rat/hacker" ) );
+ //}
MethodInvocationHandler methodInvocationHandler =
getMethodInvocationHandler( publishedThing );
@@ -244,6 +252,11 @@
Long[] refs = new Long[ beanImpls.length ];
String[] objectNames = new String[ beanImpls.length ];
+ if (!sessionExists(methodFacadeRequest.getSession()))
+ {
+ return new ExceptionReply(new
NoSuchSessionException(methodFacadeRequest.getSession()));
+ }
+
for( int i = 0; i < beanImpls.length; i++ )
{
Object impl = beanImpls[ i ];
@@ -262,12 +275,6 @@
return new NotPublishedReply();
}
- if( !sessionExists( methodFacadeRequest.getSession() ) )
- {
- return new ExceptionReply(
- new AltrmiInvocationException( "TODO - you dirty rat/hacker" )
);
- }
-
//TODO a decent ref number for main?
if( beanImpls[ i ] == null )
{
@@ -298,6 +305,11 @@
Object beanImpl, MethodFacadeRequest methodFacadeRequest )
{
+ if (!sessionExists(methodFacadeRequest.getSession()))
+ {
+ return new ExceptionReply(new
NoSuchSessionException(methodFacadeRequest.getSession()));
+ }
+
MethodInvocationHandler mainMethodInvocationHandler =
getMethodInvocationHandler(
methodFacadeRequest.getPublishedServiceName() + "_Main" );
@@ -312,11 +324,11 @@
return new NotPublishedReply();
}
- if( !sessionExists( methodFacadeRequest.getSession() ) )
- {
- return new ExceptionReply(
- new AltrmiInvocationException( "TODO - you dirty rat/hacker" ) );
- }
+ //if( !sessionExists( methodFacadeRequest.getSession() ) )
+ //{
+ // return new ExceptionReply(
+ // new AltrmiInvocationException( "TODO - you dirty rat/hacker" ) );
+ //}
//TODO a decent ref number for main?
Long newRef = methodInvocationHandler.getOrMakeReferenceIDForBean( beanImpl
);
@@ -337,7 +349,13 @@
*/
private AltrmiReply doMethodRequest( AltrmiRequest request )
{
- MethodRequest methodRequest = (MethodRequest)request;
+ MethodRequest methodRequest = (MethodRequest) request;
+
+ if (!sessionExists(methodRequest.getSession()))
+ {
+ return new ExceptionReply(new
NoSuchSessionException(methodRequest.getSession()));
+ }
+
String publishedThing = methodRequest.getPublishedServiceName() + "_" +
methodRequest.getObjectName();
if( !isPublished( publishedThing ) )
@@ -353,6 +371,13 @@
private AltrmiReply doMethodAsyncRequest(MethodAsyncRequest methodRequest)
{
+
+ if (!sessionExists(methodRequest.getSession()))
+ {
+ return new ExceptionReply(new
NoSuchSessionException(methodRequest.getSession()));
+ }
+
+
String publishedThing = methodRequest.getPublishedServiceName() + "_" +
methodRequest.getObjectName();
if( !isPublished( publishedThing ) )
@@ -490,22 +515,29 @@
return new NotPublishedReply();
}
- if( !sessionExists( gcr.getSession() ) )
+ Long session = gcr.getSession();
+ if( !sessionExists( session ) )
{
return new ExceptionReply(
new AltrmiInvocationException( "TODO - you dirty rat/hacker" ) );
}
- AltrmiSession sess = (AltrmiSession) m_sessions.get( gcr.getSession() );
+ AltrmiSession sess = (AltrmiSession) m_sessions.get( session );
if( sess == null )
{
- System.err.println( "DEBUG- GC on missing session -" + gcr.getSession()
);
+ System.err.println( "DEBUG- GC on missing session - " + session );
}
- if( gcr.getReferenceID() == null )
+ else
{
- System.err.println( "DEBUG- GC on missing referenceID -" +
gcr.getReferenceID() );
+ if( gcr.getReferenceID() == null )
+ {
+ System.err.println( "DEBUG- GC on missing referenceID -" +
gcr.getReferenceID() );
+ }
+ else
+ {
+ sess.removeBeanInUse( gcr.getReferenceID() );
+ }
}
- sess.removeBeanInUse( gcr.getReferenceID() );
MethodInvocationHandler methodInvocationHandler =
getMethodInvocationHandler( publishedThing );
@@ -562,15 +594,15 @@
return false;
}
+
/**
- * Get a newsession
+ * Get a new session ID
* @return The session
*/
private Long getNewSession()
{
-
// approve everything and set session identifier.
- return new Long( (long)( (long)c_session++ << 32 ) + (long)Math.round(
Math.random() ) );
+ return new Long((++c_session << 16) + ((long) (Math.random() * 65536)));
}
/**
1.8 +4 -4
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/PublicationAdapter.java
Index: PublicationAdapter.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/adapters/PublicationAdapter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PublicationAdapter.java 25 Nov 2002 21:17:08 -0000 1.7
+++ PublicationAdapter.java 5 Jan 2003 22:05:02 -0000 1.8
@@ -98,7 +98,7 @@
// add method maps for main lookup-able service.
HashMap mainMethodMap = new HashMap();
- MethodInvocationHandler mainMethodInvocationHandler =
+ DefaultMethodInvocationHandler mainMethodInvocationHandler =
new DefaultMethodInvocationHandler( this, asName + "_Main",
mainMethodMap, publicationDescription );
@@ -206,7 +206,7 @@
public MethodInvocationHandler getMethodInvocationHandler( MethodRequest
methodRequest,
String objectName )
{
- return (MethodInvocationHandler)m_publishedObjects.get(
+ return (MethodInvocationHandler) m_publishedObjects.get(
methodRequest.getPublishedServiceName() + "_" + objectName );
}
@@ -221,6 +221,6 @@
*/
public MethodInvocationHandler getMethodInvocationHandler( String publishedName
)
{
- return (MethodInvocationHandler)m_publishedObjects.get( publishedName );
+ return (MethodInvocationHandler) m_publishedObjects.get( publishedName );
}
}
1.6 +2 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamReadWriter.java
Index: CallbackEnabledSocketCustomStreamReadWriter.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/callback/socket/CallbackEnabledSocketCustomStreamReadWriter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CallbackEnabledSocketCustomStreamReadWriter.java 21 Sep 2002 15:52:57 -0000
1.5
+++ CallbackEnabledSocketCustomStreamReadWriter.java 5 Jan 2003 22:05:02 -0000
1.6
@@ -11,7 +11,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
-import org.apache.excalibur.altrmi.common.AltrmiConnectionClosedException;
+import org.apache.excalibur.altrmi.client.AltrmiConnectionClosedException;
import org.apache.excalibur.altrmi.common.AltrmiReply;
import org.apache.excalibur.altrmi.common.AltrmiRequest;
import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
1.4 +0 -2
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/DummyInvocationHandler.java
Index: DummyInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/client/impl/DummyInvocationHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DummyInvocationHandler.java 26 Oct 2002 14:10:50 -0000 1.3
+++ DummyInvocationHandler.java 5 Jan 2003 22:05:03 -0000 1.4
@@ -14,8 +14,6 @@
import org.apache.excalibur.altrmi.client.AltrmiConnectionListener;
import org.apache.excalibur.altrmi.client.AltrmiConnectionPinger;
-import java.io.IOException;
-
public class DummyInvocationHandler implements AltrmiClientInvocationHandler
{
1.4 +1 -1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestImpl.java
Index: CallBackTestImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CallBackTestImpl.java 19 May 2002 08:46:11 -0000 1.3
+++ CallBackTestImpl.java 5 Jan 2003 22:05:03 -0000 1.4
@@ -9,7 +9,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.excalibur.altrmi.common.AltrmiConnectionClosedException;
+import org.apache.excalibur.altrmi.client.AltrmiConnectionClosedException;
/**
* Class CallBackTestImpl
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/AltrmiConnectionClosedException.java
Index: AltrmiConnectionClosedException.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;
/**
* Class AltrmiConnectionClosedException
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class AltrmiConnectionClosedException extends RuntimeException
{
/**
* Constructor AltrmiConnectionClosedException
*
*
* @param msg the message that is the root cause.
*
*/
public AltrmiConnectionClosedException( String msg )
{
super( msg );
}
}
1.1
jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/hackers/BouncingServerTestCase.java
Index: BouncingServerTestCase.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.hackers;
import junit.framework.TestCase;
import
org.apache.excalibur.altrmi.server.impl.socket.CompleteSocketCustomStreamServer;
import org.apache.excalibur.altrmi.server.PublicationDescription;
import org.apache.excalibur.altrmi.server.AltrmiServerException;
import org.apache.excalibur.altrmi.server.PublicationException;
import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
import org.apache.excalibur.altrmi.test.TestInterface;
import org.apache.excalibur.altrmi.test.TestInterface3;
import org.apache.excalibur.altrmi.test.TestInterface2;
import org.apache.excalibur.altrmi.client.impl.ClientClassAltrmiFactory;
import org.apache.excalibur.altrmi.client.impl.NeverConnectionPinger;
import org.apache.excalibur.altrmi.client.impl.DumbConnectionListener;
import org.apache.excalibur.altrmi.client.impl.socket.SocketCustomStreamHostContext;
import org.apache.excalibur.altrmi.client.AltrmiHostContext;
import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
import org.apache.excalibur.altrmi.common.NoSuchSessionException;
/**
* Tests concerning the bouncing of a server.
* @author Paul Hammant
*/
public class BouncingServerTestCase extends TestCase
{
public BouncingServerTestCase(String name)
{
super(name);
}
public void testBouncingOfServerCausesClientProblems() throws Exception
{
// server side setup.
CompleteSocketCustomStreamServer server = startServer();
ClientClassAltrmiFactory altrmiFactory = null;
try
{
// Client side setup
altrmiFactory = new ClientClassAltrmiFactory(false);
AltrmiHostContext hc = new SocketCustomStreamHostContext("127.0.0.1",
12101);
altrmiFactory.setHostContext(hc, false);
AltrmiClientInvocationHandler ih = hc.getClientInvocationHandler();
ih.setConnectionPinger(new NeverConnectionPinger());
ih.setAltrmiConnectionListener(new DumbConnectionListener());
TestInterface 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();
int i = testClient.hello2(100);
// Stop server and restarting (essentially binning sessions).
server.stop();
server = startServer();
try
{
i = testClient.hello2(123);
}
catch (NoSuchSessionException e)
{
// expected
}
}
finally
{
System.gc();
Thread.yield();
altrmiFactory.close();
Thread.yield();
server.stop();
Thread.yield();
}
}
private CompleteSocketCustomStreamServer startServer() throws
AltrmiServerException, PublicationException
{
CompleteSocketCustomStreamServer server = new
CompleteSocketCustomStreamServer(12101);
TestInterfaceImpl testServer = new TestInterfaceImpl();
PublicationDescription pd = new PublicationDescription(TestInterface.class,
new Class[]{TestInterface3.class, TestInterface2.class});
server.publish(testServer, "Hello", pd);
server.start();
return server;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>