[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/bisocket ...

Ron Sigal ron_sigal at yahoo.com
Tue Jan 16 22:03:23 EST 2007


  User: rsigal  
  Date: 07/01/16 22:03:22

  Modified:    src/main/org/jboss/remoting/transport/bisocket 
                        BisocketServerInvoker.java
  Log:
  JBREM-298:  Makes sure socketFactory and secondayServerSocket are properly wrapped.
  
  Revision  Changes    Path
  1.4       +80 -1     JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BisocketServerInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- BisocketServerInvoker.java	16 Jan 2007 08:16:43 -0000	1.3
  +++ BisocketServerInvoker.java	17 Jan 2007 03:03:22 -0000	1.4
  @@ -41,8 +41,12 @@
   import org.jboss.remoting.Client;
   import org.jboss.remoting.InvocationRequest;
   import org.jboss.remoting.InvokerLocator;
  +import org.jboss.remoting.Remoting;
   import org.jboss.remoting.ServerInvocationHandler;
   import org.jboss.remoting.invocation.InternalInvocation;
  +import org.jboss.remoting.socketfactory.CreationListenerServerSocket;
  +import org.jboss.remoting.socketfactory.CreationListenerSocketFactory;
  +import org.jboss.remoting.socketfactory.SocketCreationListener;
   import org.jboss.remoting.transport.PortUtil;
   import org.jboss.remoting.transport.socket.LRUPool;
   import org.jboss.remoting.transport.socket.ServerThread;
  @@ -53,7 +57,7 @@
   /**
    *  
    * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    * <p>
    * Copyright Nov 23, 2006
    * </p>
  @@ -105,6 +109,7 @@
            clientpool = new LRUPool(2, maxPoolSize);
            clientpool.create();
            threadpool = new LinkedList();
  +         checkSocketFactoryWrapper();
            running = true;
            started = true;
         }
  @@ -121,6 +126,7 @@
            {
               secondaryServerSocket = new ServerSocket(freePort, 0, host);
            }
  +         checkSecondaryServerSocketWrapper();
            secondaryLocator = new InvokerLocator(null, host.getHostAddress(), freePort, null, null);
            secondaryServerSocketThread = new SecondaryServerSocketThread(secondaryServerSocket);
            secondaryServerSocketThread.setName("secondaryServerSocketThread");
  @@ -276,12 +282,85 @@
         return secondaryLocator;
      }
   
  +   
      protected ServerSocket getServerSocket()
      {
         return serverSocket;
      }
   
   
  +   protected void checkSocketFactoryWrapper() throws IOException
  +   {
  +      
  +      Object o = configuration.get(Remoting.SOCKET_CREATION_SERVER_LISTENER);
  +      log.info("got listener: " + o);
  +      if (o != null)
  +      {
  +         if (o instanceof SocketCreationListener)
  +         {
  +            SocketCreationListener listener = (SocketCreationListener) o;
  +            if (socketFactory instanceof CreationListenerSocketFactory)
  +            {
  +               CreationListenerSocketFactory clsf = (CreationListenerSocketFactory) socketFactory;
  +               clsf.setListener(listener);
  +            }
  +            else
  +            {
  +               socketFactory = new CreationListenerSocketFactory(socketFactory, listener);
  +            }
  +         }
  +         else
  +         {
  +            log.error("socket creation listener of invalid type: " + o);
  +         }
  +      }
  +      else
  +      {
  +         if (socketFactory instanceof CreationListenerSocketFactory)
  +         {
  +            CreationListenerSocketFactory clsf = (CreationListenerSocketFactory) socketFactory;
  +            socketFactory = clsf.getFactory();
  +         }
  +      }
  +   }
  +
  +   
  +   protected void checkSecondaryServerSocketWrapper() throws IOException
  +   {
  +      
  +      Object o = configuration.get(Remoting.SOCKET_CREATION_CLIENT_LISTENER);
  +      log.info("got listener: " + o);
  +      if (o != null)
  +      {
  +         if (o instanceof SocketCreationListener)
  +         {
  +            SocketCreationListener listener = (SocketCreationListener) o;
  +            if (secondaryServerSocket instanceof CreationListenerServerSocket)
  +            {
  +               CreationListenerServerSocket clss = (CreationListenerServerSocket) secondaryServerSocket;
  +               clss.setListener(listener);
  +            }
  +            else
  +            {
  +               secondaryServerSocket = new CreationListenerServerSocket(secondaryServerSocket, listener);
  +            }
  +         }
  +         else
  +         {
  +            log.error("socket creation listener of invalid type: " + o);
  +         }
  +      }
  +      else
  +      {
  +         if (secondaryServerSocket instanceof CreationListenerServerSocket)
  +         {
  +            CreationListenerServerSocket clss = (CreationListenerServerSocket) secondaryServerSocket;
  +            secondaryServerSocket = clss.getServerSocket();
  +         }
  +      }
  +   }
  +   
  +   
      protected Object handleInternalInvocation(InternalInvocation ii,
                                                InvocationRequest ir,
                                                ServerInvocationHandler handler)
  
  
  



More information about the jboss-cvs-commits mailing list