Package org.jboss.remoting.transport.multiplex

Examples of org.jboss.remoting.transport.multiplex.MultiplexServerInvoker


            }
         }
        
         // Make sure there is no virtual MultiplexServerInvoker.
         assertTrue(serverInvoker instanceof MultiplexServerInvoker);
         MultiplexServerInvoker masterInvoker = (MultiplexServerInvoker) serverInvoker;
         InetSocketAddress connectorAddress = new InetSocketAddress("localhost", 6565);
         MultiplexServerInvoker virtualInvoker = masterInvoker.getServerInvoker(connectorAddress);
         assertNull(virtualInvoker);
        
         Object response = client.invoke(new Integer(3));
         log.info("Invocation completed");
         assertNotNull(response);
View Full Code Here


        
         // Give virtual MultiplexServerInvoker time to start.
         Thread.sleep(1000);
        
         // Get master MultiplexServerInvoker
         MultiplexServerInvoker masterInvoker = null;
         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();;
         for (int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(connectorLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  masterInvoker = (MultiplexServerInvoker) serverInvokers[i];
//                  break;
               }
            }
         }
        
         assertTrue(masterInvoker != null);
        
         // Get virtual MultiplexServerInvoker
         InetSocketAddress bindAddress = new InetSocketAddress("localhost", clientPort);
         MultiplexServerInvoker virtualInvoker = masterInvoker.getServerInvoker(bindAddress);
         log.info(masterInvoker.getLocator());
         System.out.println(masterInvoker.getLocator());
         System.out.println(masterInvoker.getServerInvokers().size());
         log.info("server invokers: " + masterInvoker.getServerInvokers().size());
         assertTrue(virtualInvoker != null);
View Full Code Here

      {
         if (eventRegistry == null)
            setUp();
        
         eventRegistry.waitOnEvent(CREATED_EVENT);
         MultiplexServerInvoker serverInvoker = (MultiplexServerInvoker) connector.getServerInvoker();
         Collection virtualInvokers = serverInvoker.getServerInvokers();
         assertFalse(virtualInvokers.isEmpty());
         InetSocketAddress localAddress = new InetSocketAddress("localhost", 5281);
         InetSocketAddress remoteAddress = new InetSocketAddress("localhost", 5282);
         assertTrue(MultiplexingManager.checkForManagerByAddressPair(localAddress, remoteAddress));
        
View Full Code Here

      {
         if (eventRegistry == null)
            setUp();
        
         eventRegistry.waitOnEvent(CREATED_EVENT);
         MultiplexServerInvoker serverInvoker = (MultiplexServerInvoker) connector.getServerInvoker();
         Collection virtualInvokers = serverInvoker.getServerInvokers();
         assertFalse(virtualInvokers.isEmpty());
         InetSocketAddress localAddress = new InetSocketAddress("localhost", 5281);
         InetSocketAddress remoteAddress = new InetSocketAddress("localhost", 5282);
         assertTrue(MultiplexingManager.checkForManagerByAddressPair(localAddress, remoteAddress));
        
View Full Code Here

         // Tell test server to connect.
         os.write(13);
        
         /////////////////////////////////////////////////////////////////////////////////////
         // Get MultiplexingManager.
         MultiplexServerInvoker masterServerInvoker = (MultiplexServerInvoker) connector1.getServerInvoker();       
         while (masterServerInvoker.getServerInvokers().isEmpty())
         {
            try
            {
               Thread.sleep(1000);
            }
            catch (Exception e) {}
         }
        
         Collection virtualServerInvokers = masterServerInvoker.getServerInvokers();
         MultiplexServerInvoker virtualServerInvoker = (MultiplexServerInvoker) virtualServerInvokers.iterator().next();
         VirtualServerSocket vss = (VirtualServerSocket) virtualServerInvoker.getServerSocket();
         MultiplexingManager manager = vss.getMultiplexingManager();

         // Test MultiplexingManager parameters.
         Field field = MultiplexingManager.class.getDeclaredField("staticThreadsMonitorPeriod");
         field.setAccessible(true);
         assertEquals(field.getInt(manager), 2 + Multiplex.STATIC_THREADS_MONITOR_PERIOD_DEFAULT);
        
         field = MultiplexingManager.class.getDeclaredField("shutdownRequestTimeout");
         field.setAccessible(true);
         assertEquals(field.getInt(manager), 3 + Multiplex.SHUTDOWN_REQUEST_TIMEOUT_DEFAULT);
        
         field = MultiplexingManager.class.getDeclaredField("shutdownRefusalsMaximum");
         field.setAccessible(true);
         assertEquals(field.getInt(manager), 4 + Multiplex.SHUTDOWN_REFUSALS_MAXIMUM_DEFAULT);
        
         field = MultiplexingManager.class.getDeclaredField("shutdownMonitorPeriod");
         field.setAccessible(true);
         assertEquals(field.getInt(manager), 5 + Multiplex.SHUTDOWN_MONITOR_PERIOD_DEFAULT);
        
         /////////////////////////////////////////////////////////////////////////////////////
         // Get InputMultiplexor.
         field =  MultiplexingManager.class.getDeclaredField("inputMultiplexor");
         field.setAccessible(true);
         InputMultiplexor inputMultiplexor = (InputMultiplexor) field.get(manager);
         log.info("inputMultiplexor: " + inputMultiplexor);
        
         // Test InputMultiplexor parameters.
         field = InputMultiplexor.class.getDeclaredField("bufferSize");
         field.setAccessible(true);
         assertEquals(field.getInt(inputMultiplexor), 2 + Multiplex.INPUT_BUFFER_SIZE_DEFAULT);
        
         field = InputMultiplexor.class.getDeclaredField("maxErrors");
         field.setAccessible(true);
         assertEquals(field.getInt(inputMultiplexor), 3 + Multiplex.INPUT_MAX_ERRORS_DEFAULT);
        
         /////////////////////////////////////////////////////////////////////////////////////
         // Get OutputMultiplexor.
         field =  MultiplexingManager.class.getDeclaredField("outputMultiplexor");
         field.setAccessible(true);
         OutputMultiplexor outputMultiplexor = (OutputMultiplexor) field.get(manager);
         log.info("outputMultiplexor: " + outputMultiplexor);
        
         // Test OutputMultiplexor parameters.
         field = OutputMultiplexor.class.getDeclaredField("messagePoolSize");
         field.setAccessible(true);
         assertEquals(field.getInt(outputMultiplexor), 2 + Multiplex.OUTPUT_MESSAGE_POOL_SIZE_DEFAULT);
        
         field = OutputMultiplexor.class.getDeclaredField("messagePool");
         field.setAccessible(true);
         List messagePool = (List) field.get(outputMultiplexor);
         assertTrue(messagePool.size() <=  2 + Multiplex.OUTPUT_MESSAGE_POOL_SIZE_DEFAULT);
         
         field = OutputMultiplexor.class.getDeclaredField("messageSize");
         field.setAccessible(true);
         assertEquals(field.getInt(outputMultiplexor), 3 + Multiplex.OUTPUT_MESSAGE_SIZE_DEFAULT);
        
         Object message = messagePool.get(0);
         field = message.getClass().getDeclaredField("baos");
         field.setAccessible(true);
         ByteArrayOutputStream baos = (ByteArrayOutputStream) field.get(message);
         field = ByteArrayOutputStream.class.getDeclaredField("buf");
         field.setAccessible(true);
         byte[] buf = (byte[]) field.get(baos);
         assertEquals(buf.length, 3 + Multiplex.OUTPUT_MESSAGE_SIZE_DEFAULT);
       
         field = OutputMultiplexor.class.getDeclaredField("maxChunkSize");
         field.setAccessible(true);
         assertEquals(field.getInt(outputMultiplexor), 4 + Multiplex.OUTPUT_MAX_CHUNK_SIZE_DEFAULT);
        
         field = OutputMultiplexor.class.getDeclaredField("buffer");
         field.setAccessible(true);
         ByteBuffer bb = (ByteBuffer) field.get(outputMultiplexor);
         field = OutputMultiplexor.class.getDeclaredField("HEADER_SIZE");
         field.setAccessible(true);
         int headerSize = ((Integer) field.get(outputMultiplexor)).intValue();
         assertEquals(bb.capacity(), 4 + Multiplex.OUTPUT_MAX_CHUNK_SIZE_DEFAULT + headerSize);
        
         field = OutputMultiplexor.class.getDeclaredField("maxTimeSlice");
         field.setAccessible(true);
         assertEquals(field.getInt(outputMultiplexor), 5 + Multiplex.OUTPUT_MAX_TIME_SLICE_DEFAULT);
        
         field = OutputMultiplexor.class.getDeclaredField("maxDataSlice");
         field.setAccessible(true);
         assertEquals(field.getInt(outputMultiplexor), 6 + Multiplex.OUTPUT_MAX_DATA_SLICE_DEFAULT);
     
         /////////////////////////////////////////////////////////////////////////////////////
         // Test MultiplexServerInvoker parameter.
         field = MultiplexServerInvoker.class.getDeclaredField("maxAcceptErrors");
         field.setAccessible(true);
         assertEquals(field.getInt(masterServerInvoker), 2 + Multiplex.MAX_ACCEPT_ERRORS_DEFAULT);
         assertEquals(field.getInt(virtualServerInvoker), 2 + Multiplex.MAX_ACCEPT_ERRORS_DEFAULT);
        
         /////////////////////////////////////////////////////////////////////////////////////
         // Now, create another Connector and test parameters in new objects.  First, wait
         // until the static threads have stopped.
         connector1.stop();
         os.write(17);
        
         field = MultiplexingManager.class.getDeclaredField("allManagers");
         field.setAccessible(true);
         Collection allManagers = (Collection) field.get(manager);
        
         while (!allManagers.isEmpty())
         {
            try
            {
               Thread.sleep(1000);
            }
            catch (InterruptedException ignored) {}
         }
        
         Thread.sleep(2 * 2 * Multiplex.SHUTDOWN_MONITOR_PERIOD_DEFAULT + 2000);
         field = MultiplexingManager.class.getDeclaredField("staticThreadsRunning");
         field.setAccessible(true);
        
         // Wait until static threads are stopped.
         for (int i = 0; i < 5; i++)
         {
            if (!field.getBoolean(manager))
               break;
            Thread.sleep(2000);
         }
        
         assertFalse(field.getBoolean(manager));
        
         // Increase parameter values.
         Iterator it = conf.keySet().iterator();
         while (it.hasNext())
         {
            Object key = it.next();
            conf.put(key, new Integer(((Integer)conf.get(key)).intValue() + 2));
         }
        
         log.info("configuration: " + conf);
        
         // Create Connector.
         Connector connector2 = new Connector(ConfigurationTestServer.connectorURI4, conf);
         connector2.create();
         connector2.start();
         log.info("started Connector on: " + connector2.getInvokerLocator());
        
         // Tell test server to connect.
         os.write(19);
        
         /////////////////////////////////////////////////////////////////////////////////////
         // Get MultiplexingManager.
         masterServerInvoker = (MultiplexServerInvoker) connector2.getServerInvoker();       
         while (masterServerInvoker.getServerInvokers().isEmpty())
         {
            try
            {
               Thread.sleep(1000);
            }
            catch (Exception e) {}
         }
        
         virtualServerInvokers = masterServerInvoker.getServerInvokers();
         virtualServerInvoker = (MultiplexServerInvoker) virtualServerInvokers.iterator().next();
         vss = (VirtualServerSocket) virtualServerInvoker.getServerSocket();
         manager = vss.getMultiplexingManager();

         // Test MultiplexingManager parameters.
         field = MultiplexingManager.class.getDeclaredField("staticThreadsMonitorPeriod");
         field.setAccessible(true);
View Full Code Here

         InvokerLocator callbackLocator = new InvokerLocator(callbackURI);
         tester.setupServer(callbackLocator, configuration);
         assertTrue(InvokerRegistry.isServerInvokerRegistered(callbackLocator));

         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
         MultiplexServerInvoker multiplexServerInvoker = null;

         for(int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(callbackLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  multiplexServerInvoker = (MultiplexServerInvoker) serverInvokers[i];
               }
            }
         }

         assertTrue(multiplexServerInvoker != null);
         assertTrue(multiplexServerInvoker.getLocator().equals(callbackLocator));
         assertTrue(multiplexServerInvoker.getBacklog() == 2);
         assertTrue(multiplexServerInvoker.getNumAcceptThreads() == 5);
         assertTrue(multiplexServerInvoker.getTimeout() == 300000);
         ServerSocket serverSocket = multiplexServerInvoker.getServerSocket();
         assertTrue(serverSocket instanceof VirtualServerSocket);
         VirtualServerSocket vss = (VirtualServerSocket) serverSocket;
         assertTrue(vss.getRemotePort() == serverPort);
         assertTrue(tester.runPushCallbackTest(callbackLocator));
         log.info("testRule1ClientFirst() PASSES");
View Full Code Here

         configuration.put(Multiplex.MULTIPLEX_CONNECT_HOST, serverHost);
         configuration.put(Multiplex.MULTIPLEX_CONNECT_PORT, Integer.toString(serverPort));
         tester.setupServer(callbackLocator, configuration);
         assertTrue(InvokerRegistry.isServerInvokerRegistered(callbackLocator));
         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
         MultiplexServerInvoker multiplexServerInvoker = null;

         for(int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(callbackLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  multiplexServerInvoker = (MultiplexServerInvoker) serverInvokers[i];
               }
            }
         }

         assertTrue(multiplexServerInvoker != null);
         assertTrue(multiplexServerInvoker.getLocator().equals(callbackLocator));
         assertTrue(multiplexServerInvoker.getBacklog() == 2);
         assertTrue(multiplexServerInvoker.getNumAcceptThreads() == 5);
         assertTrue(multiplexServerInvoker.getTimeout() == 300000);
         ServerSocket serverSocket = multiplexServerInvoker.getServerSocket();
         assertTrue(serverSocket instanceof VirtualServerSocket);
         VirtualServerSocket vss = (VirtualServerSocket) serverSocket;
         assertTrue(vss.getRemotePort() == serverPort);

         InvokerLocator serverLocator = new InvokerLocator(getTransport() + "://" + serverHost + ":" + serverPort);
View Full Code Here

         configuration.put(Multiplex.MULTIPLEX_CONNECT_PORT, Integer.toString(serverPort));
         tester.setupServer(callbackLocator, configuration);
         assertTrue(InvokerRegistry.isServerInvokerRegistered(callbackLocator));

         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
         MultiplexServerInvoker multiplexServerInvoker = null;

         for(int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(callbackLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  multiplexServerInvoker = (MultiplexServerInvoker) serverInvokers[i];
               }
            }
         }

         assertTrue(multiplexServerInvoker != null);
         assertTrue(multiplexServerInvoker.getLocator().equals(callbackLocator));
         assertTrue(multiplexServerInvoker.getBacklog() == 2);
         assertTrue(multiplexServerInvoker.getNumAcceptThreads() == 5);
         assertTrue(multiplexServerInvoker.getTimeout() == 300000);
         ServerSocket serverSocket = multiplexServerInvoker.getServerSocket();
         assertTrue(serverSocket instanceof VirtualServerSocket);
         VirtualServerSocket vss = (VirtualServerSocket) serverSocket;
         assertTrue(vss.getRemotePort() == serverPort);
         assertTrue(tester.runPushCallbackTest(callbackLocator));
         log.info("testRule2ClientFirst() PASSES");
View Full Code Here

        
         // Give virtual MultiplexServerInvoker time to start.
         Thread.sleep(1000);
        
         // Get master MultiplexServerInvoker
         MultiplexServerInvoker masterInvoker = null;
         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();;
         for (int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(connectorLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  masterInvoker = (MultiplexServerInvoker) serverInvokers[i];
//                  break;
               }
            }
         }
        
         assertTrue(masterInvoker != null);
        
         // Get virtual MultiplexServerInvoker
         InetSocketAddress bindAddress = new InetSocketAddress("localhost", clientPort);
         MultiplexServerInvoker virtualInvoker = masterInvoker.getServerInvoker(bindAddress);
         log.info(masterInvoker.getLocator());
         System.out.println(masterInvoker.getLocator());
         System.out.println(masterInvoker.getServerInvokers().size());
         log.info("server invokers: " + masterInvoker.getServerInvokers().size());
         assertTrue(virtualInvoker != null);
View Full Code Here

         configuration.put(Multiplex.MULTIPLEX_CONNECT_HOST, serverHost);
         configuration.put(Multiplex.MULTIPLEX_CONNECT_PORT, Integer.toString(serverPort));
         tester.setupServer(callbackLocator, configuration);
         assertTrue(InvokerRegistry.isServerInvokerRegistered(callbackLocator));
         ServerInvoker[] serverInvokers = InvokerRegistry.getServerInvokers();
         MultiplexServerInvoker multiplexServerInvoker = null;

         for(int i = 0; i < serverInvokers.length; i++)
         {
            if(serverInvokers[i].getLocator().equals(callbackLocator))
            {
               if(serverInvokers[i] instanceof MultiplexServerInvoker)
               {
                  multiplexServerInvoker = (MultiplexServerInvoker) serverInvokers[i];
               }
            }
         }

         assertTrue(multiplexServerInvoker != null);
         assertTrue(multiplexServerInvoker.getLocator().equals(callbackLocator));
         assertTrue(multiplexServerInvoker.getBacklog() == 2);
         assertTrue(multiplexServerInvoker.getNumAcceptThreads() == 5);
         assertTrue(multiplexServerInvoker.getTimeout() == 300000);
         ServerSocket serverSocket = multiplexServerInvoker.getServerSocket();
         assertTrue(serverSocket instanceof VirtualServerSocket);
         VirtualServerSocket vss = (VirtualServerSocket) serverSocket;
         assertTrue(vss.getRemotePort() == serverPort);

         InvokerLocator serverLocator = new InvokerLocator(getTransport() + "://" + serverHost + ":" + serverPort);
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.multiplex.MultiplexServerInvoker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.