incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: incubator-altrmi/src/test/org/apache/altrmi/test/messenger SynchronousMessengerTestCase.java MessengerTestCase.java
Date Tue, 25 Mar 2003 08:07:30 GMT
hammant     2003/03/25 00:07:30

  Modified:    .        default.properties
               src/java/org/apache/altrmi/client/impl AbstractFactory.java
               src/java/org/apache/altrmi/client/impl/messenger
                        SynchronousMessengerHostContext.java
               src/java/org/apache/altrmi/server ServerMonitor.java
               src/java/org/apache/altrmi/server/impl
                        ConsoleServerMonitor.java
                        LogEnabledServerMonitor.java NullServerMonitor.java
                        StreamServerConnection.java
               src/java/org/apache/altrmi/server/impl/callback/stream
                        CallbackEnabledCustomStreamReadWriter.java
               src/java/org/apache/altrmi/server/impl/messenger
                        SynchronousMessengerServer.java
               src/java/org/apache/altrmi/server/impl/socket
                        AbstractCompleteSocketStreamServer.java
                        AbstractPartialSocketStreamServer.java
  Added:       src/java/org/apache/altrmi/client/impl/messenger
                        SynchronousMessengerClientInvocationHandler.java
               src/test/org/apache/altrmi/test/messenger
                        SynchronousMessengerTestCase.java
  Removed:     src/test/org/apache/altrmi/test/messenger
                        MessengerTestCase.java
  Log:
  Coded but non-functioning JMS using syncronous transport
  
  Revision  Changes    Path
  1.6       +1 -1      incubator-altrmi/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/default.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- default.properties	21 Mar 2003 07:44:17 -0000	1.5
  +++ default.properties	25 Mar 2003 08:07:29 -0000	1.6
  @@ -8,7 +8,7 @@
   name=altrmi
   Name=AltRMI
   dir-name=altrmi
  -version=0.9.2
  +version=0.9.3
   year=2002-2003
   
   project.home=.
  
  
  
  1.3       +4 -4      incubator-altrmi/src/java/org/apache/altrmi/client/impl/AbstractFactory.java
  
  Index: AbstractFactory.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/client/impl/AbstractFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractFactory.java	17 Feb 2003 20:27:40 -0000	1.2
  +++ AbstractFactory.java	25 Mar 2003 08:07:29 -0000	1.3
  @@ -90,7 +90,7 @@
   {
   
       private static final UID U_ID = new UID((short)20729);
  -    protected AbstractHostContext m_hostContext;
  +    protected HostContext m_hostContext;
       protected ClientInvocationHandler m_clientInvocationHandler;
       protected final HashMap m_refObjs = new HashMap();
       private transient String m_textToSign;
  @@ -118,11 +118,11 @@
       {
           if( m_hostContext == null )
           {
  -            m_hostContext = (AbstractHostContext) hostContext;
  +            m_hostContext = hostContext;
               m_clientInvocationHandler = m_hostContext.getClientInvocationHandler();
           }
   
  -        ( (AbstractClientInvocationHandler) m_clientInvocationHandler ).initialize();
  +        m_clientInvocationHandler.initialize();
   
           UID machineID = allowOptimize ? U_ID : null;
   
  
  
  
  1.3       +18 -2     incubator-altrmi/src/java/org/apache/altrmi/client/impl/messenger/SynchronousMessengerHostContext.java
  
  Index: SynchronousMessengerHostContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/client/impl/messenger/SynchronousMessengerHostContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SynchronousMessengerHostContext.java	21 Mar 2003 08:12:59 -0000	1.2
  +++ SynchronousMessengerHostContext.java	25 Mar 2003 08:07:29 -0000	1.3
  @@ -58,11 +58,27 @@
   import org.apache.altrmi.client.ClientInvocationHandler;
   import org.apache.commons.messenger.Messenger;
   
  +import javax.jms.JMSException;
  +
  +/**
  + * Class SynchronousMessengerHostContext
  + *
  + *
  + * @author Paul Hammant & Mauro Talevi
  + * @version $Revision$
  + */
   public class SynchronousMessengerHostContext implements HostContext {
  -    public SynchronousMessengerHostContext(Messenger clientMessenger) {
  +    private Messenger m_clientMessenger;
  +    private String m_subject;
  +    private SynchronousMessengerClientInvocationHandler m_messengerClientInvocationHandler;
  +
  +    public SynchronousMessengerHostContext(Messenger clientMessenger, String subject) throws
JMSException {
  +        m_clientMessenger = clientMessenger;
  +        m_subject = subject;
  +        m_messengerClientInvocationHandler = new SynchronousMessengerClientInvocationHandler(m_clientMessenger,
m_subject);
       }
   
       public ClientInvocationHandler getClientInvocationHandler() {
  -        return null;
  +        return m_messengerClientInvocationHandler;
       }
   }
  
  
  
  1.1                  incubator-altrmi/src/java/org/apache/altrmi/client/impl/messenger/SynchronousMessengerClientInvocationHandler.java
  
  Index: SynchronousMessengerClientInvocationHandler.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Incubator", "AltRMI", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.altrmi.client.impl.messenger;
  
  import org.apache.altrmi.client.ClientMonitor;
  import org.apache.altrmi.client.NoSuchReferenceException;
  import org.apache.altrmi.client.NotPublishedException;
  import org.apache.altrmi.client.impl.AbstractClientInvocationHandler;
  import org.apache.altrmi.common.AltrmiRuntimeException;
  import org.apache.altrmi.common.MethodRequest;
  import org.apache.altrmi.common.NoSuchReferenceReply;
  import org.apache.altrmi.common.NotPublishedReply;
  import org.apache.altrmi.common.PublishedNameRequest;
  import org.apache.altrmi.common.Reply;
  import org.apache.altrmi.common.Request;
  import org.apache.altrmi.common.RequestConstants;
  import org.apache.altrmi.common.TryLaterReply;
  import org.apache.commons.messenger.Messenger;
  
  import javax.jms.Destination;
  import javax.jms.JMSException;
  import javax.jms.Message;
  import javax.jms.ObjectMessage;
  import javax.swing.*;
  
  /**
   * Class SynchronousMessengerClientInvocationHandler
   *
   *
   * @author Paul Hammant & Mauro Talevi
   * @version $Revision: 1.1 $
   */
  public final class SynchronousMessengerClientInvocationHandler extends AbstractClientInvocationHandler
  {
  
      private boolean m_methodLogging = false;
      private long m_lastRealRequest = System.currentTimeMillis();
      private Messenger m_clientMessenger;
      private String m_subject;
      private Destination m_destination;
  
      /**
       * Constructor SynchronousMessengerClientInvocationHandler
       *
       *
       * @param clientMessenger
       *
       * @throws JMSException
       *
       */
      public SynchronousMessengerClientInvocationHandler(Messenger clientMessenger, String
subject) throws JMSException
      {
          m_clientMessenger = clientMessenger;
          m_subject = subject;
          m_destination = m_clientMessenger.getDestination( m_subject );
      }
  
      /**
       * Method setClientMonitor
       *
       *
       * @param connectionMonitor
       *
       */
      public void setClientMonitor(ClientMonitor connectionMonitor)
      {
  
          super.setClientMonitor(connectionMonitor);
  
          m_methodLogging = connectionMonitor.methodLogging();
      }
  
      /**
       * Method tryReconnect
       *
       * @return
       *
       */
      protected boolean tryReconnect()
      {
          return true;
      }
  
      /**
       * Method handleInvocation
       *
       *
       * @param request
       *
       * @return
       *
       */
      public synchronized Reply handleInvocation(Request request)
      {
  
          if (request.getRequestCode() != RequestConstants.PINGREQUEST)
          {
              m_lastRealRequest = System.currentTimeMillis();
          }
  
          boolean again = true;
          Reply reply = null;
          int tries = 0;
          long start = 0;
  
          if (m_methodLogging)
          {
              start = System.currentTimeMillis();
          }
  
          while (again)
          {
              tries++;
  
              again = false;
  
              reply = handleJMSInvocation(request);
  
              if (reply.getReplyCode() >= 100)
              {
                  if (reply instanceof TryLaterReply)
                  {
                      int millis = ((TryLaterReply) reply).getSuggestedDelayMillis();
  
                      m_clientMonitor.serviceSuspended(this.getClass(), request, tries, millis);
  
                      again = true;
                  } else if (reply instanceof NoSuchReferenceReply)
                  {
                      throw new NoSuchReferenceException(((NoSuchReferenceReply) reply)
                              .getReferenceID());
                  } else if (reply instanceof NotPublishedReply)
                  {
                      PublishedNameRequest pnr = (PublishedNameRequest) request;
  
                      throw new NotPublishedException(pnr.getPublishedServiceName(),
                              pnr.getObjectName());
                  }
              }
          }
  
          if (m_methodLogging)
          {
              if (request instanceof MethodRequest)
              {
                  m_clientMonitor.methodCalled(
                          this.getClass(), ((MethodRequest) request).getMethodSignature(),
                          System.currentTimeMillis() - start, "");
              }
          }
  
          return reply;
      }
  
      private Reply handleJMSInvocation(Request request)
      {
          try
          {
              ObjectMessage message = m_clientMessenger.createObjectMessage(request);
  
              JFrame jf = new JFrame("hello");
              jf.setVisible(true);
              Message response = m_clientMessenger.call(m_destination, message);
              jf = new JFrame("hello2");
              jf.setVisible(true);
  
              if (response instanceof ObjectMessage)
              {
                  ObjectMessage objectMessage = (ObjectMessage) response;
                  return (Reply) objectMessage.getObject();
              }
              else
              {
                  throw new AltrmiRuntimeException("Wrong return type from Messenger");
              }
          }
          catch (JMSException e)
          {
              throw new AltrmiRuntimeException("JMSException during invocation:" + e.getMessage());
          }
  
      }
  
      /**
       * Method getLastRealRequest
       *
       *
       * @return
       *
       */
      public long getLastRealRequest()
      {
          return m_lastRealRequest;
      }
  }
  
  
  
  1.3       +1 -3      incubator-altrmi/src/java/org/apache/altrmi/server/ServerMonitor.java
  
  Index: ServerMonitor.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/ServerMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServerMonitor.java	17 Feb 2003 20:28:38 -0000	1.2
  +++ ServerMonitor.java	25 Mar 2003 08:07:29 -0000	1.3
  @@ -71,8 +71,6 @@
   
       void badConnection(Class clazz, String s, BadConnectionException bce);
   
  -    void connectionProblem(Class clazz, String s, IOException ioe);
  -
       void classNotFound(Class clazz, ClassNotFoundException e);
   
       void unexpectedException(Class clazz, String s, Exception e);
  
  
  
  1.3       +1 -5      incubator-altrmi/src/java/org/apache/altrmi/server/impl/ConsoleServerMonitor.java
  
  Index: ConsoleServerMonitor.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/ConsoleServerMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConsoleServerMonitor.java	17 Feb 2003 20:28:39 -0000	1.2
  +++ ConsoleServerMonitor.java	25 Mar 2003 08:07:30 -0000	1.3
  @@ -99,8 +99,4 @@
           System.out.println("[stopServerError] " + s + " : " + e.getMessage());
       }
   
  -    public void connectionProblem(Class clazz, String s, IOException ioe)
  -    {
  -        System.out.println("[connectionProblem] " + s + " : " + ioe.getMessage());
  -    }
   }
  
  
  
  1.3       +1 -5      incubator-altrmi/src/java/org/apache/altrmi/server/impl/LogEnabledServerMonitor.java
  
  Index: LogEnabledServerMonitor.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/LogEnabledServerMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogEnabledServerMonitor.java	17 Feb 2003 20:29:01 -0000	1.2
  +++ LogEnabledServerMonitor.java	25 Mar 2003 08:07:30 -0000	1.3
  @@ -106,8 +106,4 @@
           getLogger().error("[stopServerError] " + s, e);
       }
   
  -    public void connectionProblem(Class clazz, String s, IOException ioe)
  -    {
  -        getLogger().error("[connectionProblem] " + s, ioe);
  -    }
   }
  
  
  
  1.3       +1 -4      incubator-altrmi/src/java/org/apache/altrmi/server/impl/NullServerMonitor.java
  
  Index: NullServerMonitor.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/NullServerMonitor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NullServerMonitor.java	17 Feb 2003 20:29:01 -0000	1.2
  +++ NullServerMonitor.java	25 Mar 2003 08:07:30 -0000	1.3
  @@ -93,7 +93,4 @@
       {
       }
   
  -    public void connectionProblem(Class clazz, String s, IOException ioe)
  -    {
  -    }
   }
  
  
  
  1.4       +2 -2      incubator-altrmi/src/java/org/apache/altrmi/server/impl/StreamServerConnection.java
  
  Index: StreamServerConnection.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/StreamServerConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StreamServerConnection.java	20 Feb 2003 07:36:58 -0000	1.3
  +++ StreamServerConnection.java	25 Mar 2003 08:07:30 -0000	1.4
  @@ -164,7 +164,7 @@
                   catch (ConnectionException ace)
                   {
                       more = false;
  -                    m_serverMonitor.connectionProblem(this.getClass(), "StreamServerConnection.run():
Unexpected ConnectionException #0", ace);
  +                    m_serverMonitor.unexpectedException(this.getClass(), "StreamServerConnection.run():
Unexpected ConnectionException #0", ace);
                       m_readWriter.close();
                   }
                   catch (IOException ioe)
  
  
  
  1.4       +2 -2      incubator-altrmi/src/java/org/apache/altrmi/server/impl/callback/stream/CallbackEnabledCustomStreamReadWriter.java
  
  Index: CallbackEnabledCustomStreamReadWriter.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/callback/stream/CallbackEnabledCustomStreamReadWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CallbackEnabledCustomStreamReadWriter.java	20 Feb 2003 07:36:59 -0000	1.3
  +++ CallbackEnabledCustomStreamReadWriter.java	25 Mar 2003 08:07:30 -0000	1.4
  @@ -399,7 +399,7 @@
                   }
                   catch (ConnectionException connectionException)
                   {
  -                    m_serverMonitor.connectionProblem(this.getClass(), "Connection issue
on lookup", connectionException);
  +                    m_serverMonitor.unexpectedException(this.getClass(), "Connection issue
on lookup", connectionException);
                   }
               }
           }
  
  
  
  1.3       +101 -6    incubator-altrmi/src/java/org/apache/altrmi/server/impl/messenger/SynchronousMessengerServer.java
  
  Index: SynchronousMessengerServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/messenger/SynchronousMessengerServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SynchronousMessengerServer.java	21 Mar 2003 08:13:00 -0000	1.2
  +++ SynchronousMessengerServer.java	25 Mar 2003 08:07:30 -0000	1.3
  @@ -54,20 +54,115 @@
    */
   package org.apache.altrmi.server.impl.messenger;
   
  -import org.apache.altrmi.server.impl.AbstractServer;
  +import org.apache.altrmi.common.AltrmiRuntimeException;
  +import org.apache.altrmi.common.Reply;
  +import org.apache.altrmi.common.Request;
  +import org.apache.altrmi.common.SerializationHelper;
  +import org.apache.altrmi.common.ThreadContext;
   import org.apache.altrmi.server.ServerException;
  +import org.apache.altrmi.server.impl.AbstractServer;
  +import org.apache.altrmi.server.impl.adapters.InvocationHandlerAdapter;
   import org.apache.commons.messenger.Messenger;
  +import org.apache.commons.messenger.MessengerListener;
  +
  +import javax.jms.Destination;
  +import javax.jms.JMSException;
  +import javax.jms.Message;
  +import javax.jms.ObjectMessage;
  +import java.io.Writer;
   
  -public class SynchronousMessengerServer extends AbstractServer {
  -    public SynchronousMessengerServer(Messenger messenger) {
  -        super(null); //TODO
  +/**
  + * Class SynchronousMessengerServer
  + *
  + *
  + * @author Paul Hammant & Mauro Talevi
  + * @version $Revision$
  + */
  +public class SynchronousMessengerServer extends AbstractServer implements Runnable {
  +    private Messenger m_messenger;
  +    private String m_subject;
  +    private Destination m_destination;
  +    private ThreadContext m_threadContext;
  +
  +    public SynchronousMessengerServer(Messenger messenger, String subject) {
  +        super(new InvocationHandlerAdapter());
  +        m_messenger = messenger;
  +        m_subject = subject;
       }
   
       public void start() throws ServerException {
  -        //TODO
  +
  +        try
  +        {
  +            m_destination = m_messenger.getDestination( m_subject );
  +        }
  +        catch (JMSException e)
  +        {
  +        }
  +        if ( m_destination == null ) {
  +            throw new ServerException( "Could not find JMS destination: " + m_subject );
  +        }
  +
  +        m_threadContext = getThreadPool().getThreadContext(this);
  +        m_threadContext.start();
       }
   
       public void stop() {
  -        //TODO
  +        m_threadContext.interrupt();
  +        m_threadContext = null;
  +        try
  +        {
  +            m_messenger.close();
  +        } catch (JMSException e)
  +        {
  +            getServerMonitor().stopServerError(this.getClass(),"SynchronousMessengerServer.stop()
JMSException",e);
  +        }
  +    }
  +
  +    /**
  +     * Daemon Thread
  +     */
  +    public void run() {
  +
  +        try
  +        {
  +            final Message message = m_messenger.receive( m_destination );
  +
  +            Runnable runnable = new Runnable() {
  +                public void run() {
  +                    try
  +                    {
  +                        if ( message instanceof ObjectMessage )
  +                        {
  +                            ObjectMessage objectMessage = (ObjectMessage) message;
  +                            Object obj = objectMessage.getObject();
  +                            if (obj instanceof byte[])
  +                            {
  +                                byte[] requestBytes = (byte[]) obj;
  +                                Request req = (Request) SerializationHelper.getInstanceFromBytes(requestBytes);
  +                                Reply reply = handleInvocation(req, "JMS:" + message.getJMSReplyTo().toString());
  +                                Destination dest = message.getJMSReplyTo();
  +                                byte[] replyBytes = SerializationHelper.getBytesFromInstance(reply);
  +                                ObjectMessage om = m_messenger.createObjectMessage( replyBytes
);
  +                                //TODO-JAMES om.setJMSMessageID(??);
  +                                m_messenger.send(dest, om);
  +                            }
  +                        }
  +                    } catch (JMSException e)
  +                    {
  +                        getServerMonitor().unexpectedException(this.getClass(),"SynchronousMessengerServer.run()
JMSException #1",e);
  +                    } catch (ClassNotFoundException e)
  +                    {
  +                        getServerMonitor().classNotFound(this.getClass(),e);
  +                    }
  +                }
  +            };
  +            getThreadPool().getThreadContext(runnable);
  +
  +        }
  +        catch (JMSException e)
  +        {
  +            getServerMonitor().unexpectedException(this.getClass(),"SynchronousMessengerServer.run()
JMSException #2",e);
  +        }
       }
   }
  
  
  
  1.6       +2 -2      incubator-altrmi/src/java/org/apache/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java
  
  Index: AbstractCompleteSocketStreamServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/socket/AbstractCompleteSocketStreamServer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractCompleteSocketStreamServer.java	17 Mar 2003 03:11:36 -0000	1.5
  +++ AbstractCompleteSocketStreamServer.java	25 Mar 2003 08:07:30 -0000	1.6
  @@ -166,7 +166,7 @@
               else
               {
   
  -                getServerMonitor().connectionProblem(this.getClass(), "AbstractCompleteSocketStreamServer.run():
Some problem connecting client " +
  +                getServerMonitor().unexpectedException(this.getClass(), "AbstractCompleteSocketStreamServer.run():
Some problem connecting client " +
                           "via sockets: ", ioe);
               }
           }
  
  
  
  1.3       +3 -3      incubator-altrmi/src/java/org/apache/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java
  
  Index: AbstractPartialSocketStreamServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-altrmi/src/java/org/apache/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractPartialSocketStreamServer.java	17 Feb 2003 20:29:05 -0000	1.2
  +++ AbstractPartialSocketStreamServer.java	25 Mar 2003 08:07:30 -0000	1.3
  @@ -102,7 +102,7 @@
           }
           catch( SocketException se )
           {
  -            getServerMonitor().connectionProblem(this.getClass(), "AbstractPartialSocketStreamServer.handleConnection():
Some error during " +
  +            getServerMonitor().unexpectedException(this.getClass(), "AbstractPartialSocketStreamServer.handleConnection():
Some error during " +
                       "socket handling", se);
           }
   
  @@ -124,7 +124,7 @@
           catch( IOException ioe )
           {
   
  -            getServerMonitor().connectionProblem(this.getClass(), "AbstractPartialSocketStreamServer.handleConnection():
Some problem connecting " +
  +            getServerMonitor().unexpectedException(this.getClass(), "AbstractPartialSocketStreamServer.handleConnection():
Some problem connecting " +
                       "client via sockets: ", ioe);
           }
       }
  
  
  
  1.1                  incubator-altrmi/src/test/org/apache/altrmi/test/messenger/SynchronousMessengerTestCase.java
  
  Index: SynchronousMessengerTestCase.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Incubator", "AltRMI", and "Apache Software Foundation"
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.altrmi.test.messenger;
  
  import org.apache.altrmi.client.impl.ClientSideClassFactory;
  import org.apache.altrmi.client.impl.messenger.SynchronousMessengerHostContext;
  import org.apache.altrmi.server.PublicationDescription;
  import org.apache.altrmi.server.impl.messenger.SynchronousMessengerServer;
  import org.apache.altrmi.test.AbstractHelloTestCase;
  import org.apache.altrmi.test.TestInterface;
  import org.apache.altrmi.test.TestInterface2;
  import org.apache.altrmi.test.TestInterface3;
  import org.apache.altrmi.test.TestInterfaceImpl;
  import org.apache.commons.messenger.Messenger;
  import org.apache.commons.messenger.MessengerManager;
  
  /**
   * Class SynchronousMessengerTestCase
   *
   *
   * @author Paul Hammant & Mauro Talevi
   * @version $Revision: 1.1 $
   */
  public class SynchronousMessengerTestCase extends AbstractHelloTestCase
  {
      private Messenger serverMessenger;
      private Messenger clientMessenger;
  
      public SynchronousMessengerTestCase(String name)
      {
          super(name);
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
  
          // server side setup.
  
          // TODO this needed?
          Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
  
          serverMessenger = MessengerManager.get("cacheTopicConnection");
          server = new SynchronousMessengerServer(serverMessenger, "Server-Subject");
          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 ClientSideClassFactory();
          clientMessenger = MessengerManager.get("cacheTopicConnection");
          //TODO-JAMES - gets here
          altrmiFactory.setHostContext(new SynchronousMessengerHostContext(clientMessenger,
"Client-Subject"), false);
          //TODO-JAMES - but not here
          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: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message