hammant     2003/02/04 16:28:55

  Modified:    altrmi/src/java/org/apache/excalibur/altrmi/server/impl
                        LogEnabledServerMonitor.java
               altrmi/src/test/org/apache/excalibur/altrmi/test/socket
                        CallbackEnabledCustomStreamTestCase.java
  Log:
  Start of debug of server and client monotor for callbacks.
  
  Revision  Changes    Path
  1.3       +12 -1     
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/LogEnabledServerMonitor.java
  
  Index: LogEnabledServerMonitor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/LogEnabledServerMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogEnabledServerMonitor.java      27 Jan 2003 22:18:54 -0000      1.2
  +++ LogEnabledServerMonitor.java      5 Feb 2003 00:28:55 -0000       1.3
  @@ -11,6 +11,7 @@
   import org.apache.excalibur.altrmi.server.ServerMonitor;
   import org.apache.excalibur.altrmi.common.BadConnectionException;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.logger.Logger;
   
   import java.io.IOException;
   
  @@ -23,6 +24,16 @@
    */
   public class LogEnabledServerMonitor extends AbstractLogEnabled implements 
ServerMonitor
   {
  +
  +    public LogEnabledServerMonitor()
  +    {
  +    }
  +
  +    public LogEnabledServerMonitor(Logger logger)
  +    {
  +        super.enableLogging(logger);
  +    }
  +
   
       public void closeError(String s, IOException e)
       {
  
  
  
  1.13      +48 -2     
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CallbackEnabledCustomStreamTestCase.java  1 Feb 2003 17:46:07 -0000       
1.12
  +++ CallbackEnabledCustomStreamTestCase.java  5 Feb 2003 00:28:55 -0000       
1.13
  @@ -9,6 +9,9 @@
   
   import org.apache.excalibur.altrmi.client.impl.ClientSideClassFactory;
   import 
org.apache.excalibur.altrmi.client.impl.callback.socket.CallbackEnabledSocketCustomStreamHostContext;
  +import org.apache.excalibur.altrmi.client.HostContext;
  +import org.apache.excalibur.altrmi.client.ConnectionListener;
  +import org.apache.excalibur.altrmi.client.ConnectionClosedException;
   
   import org.apache.excalibur.altrmi.test.TestInterface;
   import org.apache.excalibur.altrmi.test.TestInterfaceImpl;
  @@ -16,9 +19,14 @@
   import org.apache.excalibur.altrmi.test.TestInterface2;
   import org.apache.excalibur.altrmi.test.AbstractHelloCallBackTestCase;
   import 
org.apache.excalibur.altrmi.server.impl.callback.socket.CallbackEnabledSocketCustomStreamServer;
  +import org.apache.excalibur.altrmi.server.impl.LogEnabledServerMonitor;
   import org.apache.excalibur.altrmi.server.PublicationDescription;
  +import org.apache.excalibur.altrmi.common.Request;
  +import org.apache.excalibur.altrmi.common.InvocationException;
  +import org.apache.avalon.framework.logger.ConsoleLogger;
   
   import java.util.HashMap;
  +import java.io.IOException;
   
   
   /**
  @@ -44,12 +52,50 @@
           PublicationDescription pd = new 
PublicationDescription(TestInterface.class,
                   new Class[] { TestInterface3.class, TestInterface2.class });
           server.publish(testServer, "Hello", pd);
  +        server.setServerMonitor(new LogEnabledServerMonitor(new 
ConsoleLogger()));
           server.start();
   
           // Client side setup
           altrmiFactory = new ClientSideClassFactory();
  -        altrmiFactory.setHostContext(
  -                new 
CallbackEnabledSocketCustomStreamHostContext("127.0.0.1", 10004), false);
  +        HostContext hc = new 
CallbackEnabledSocketCustomStreamHostContext("127.0.0.1", 10004);
  +        hc.getClientInvocationHandler().setConnectionListener(new 
ConnectionListener() {
  +            public void methodCalled(String methodSignature, long duration, 
String annotation)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.methodCalled " + 
methodSignature);
  +            }
  +
  +            public boolean methodLogging()
  +            {
  +                return true;
  +            }
  +
  +            public void serviceSuspended(Request altrmiRequest, int attempt, 
int suggestedWaitMillis)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.serviceSuspended");
  +            }
  +
  +            public void serviceAbend(int attempt, IOException cause)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.serviceAbend");
  +            }
  +
  +            public void invocationFailure(String name, InvocationException 
ie)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.invocationFailure");
  +            }
  +
  +            public void unexpectedClosedConnection(String name, 
ConnectionClosedException cce)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.unexpectedClosedConnection");
  +            }
  +
  +            public void unexpectedInterruption(String name, 
InterruptedException ie)
  +            {
  +                
System.out.println("CallbackEnabledCustomStreamTestCase.unexpectedInterruption");
  +            }
  +        });
  +        altrmiFactory.setHostContext(hc , false);
  +
           testClient = (TestInterface) altrmiFactory.lookup("Hello");
   
           // just a kludge for unit testing given we are intrinsically dealing 
with
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to