Package org.jboss.remoting.transport

Examples of org.jboss.remoting.transport.Connector


   {
      log.info("Test remoting mem leaks");
     
      Thread.sleep(10 * 1000);
     
      Connector serverConnector = new Connector();

      InvokerLocator serverLocator = new InvokerLocator("socket://localhost:9099");

      serverConnector.setInvokerLocator(serverLocator.getLocatorURI());

      serverConnector.create();
     
      serverConnector.setLeasePeriod(5000);
     
      serverConnector.addConnectionListener(new SimpleConnectionListener());

      SimpleServerInvocationHandler invocationHandler = new SimpleServerInvocationHandler();

      serverConnector.addInvocationHandler("JMS", invocationHandler);

      serverConnector.start();

      InvokerLocator serverLocator2 = new InvokerLocator("socket://localhost:9099/forceRemoting=true&leasing=true");
     
      for (int i = 0; i < 500; i++)
      {
         Client cl = new Client(serverLocator2);
        
         cl.connect();
        
         for (int j = 0; j < 100; j++)
         {
            cl.invoke("pickled onions");
         }
        
         cl.disconnect();
      }
    
      serverConnector.stop();
     
      serverConnector.destroy();     
     
      log.info("done");
   }
View Full Code Here


      if (connector != null)
      {
         return;
      }

      connector = new Connector();
      connector.setInvokerLocator(locator.getLocatorURI());
      connector.start();
   }
View Full Code Here

   // Public ---------------------------------------------------------------------------------------

   public void testInvokerThreadSafety() throws Exception
   {
      Connector serverConnector = new Connector();

      InvokerLocator serverLocator = new InvokerLocator("socket://localhost:9099");

      serverConnector.setInvokerLocator(serverLocator.getLocatorURI());

      serverConnector.create();

      SimpleServerInvocationHandler invocationHandler = new SimpleServerInvocationHandler();

      serverConnector.addInvocationHandler("JMS", invocationHandler);

      serverConnector.start();

      // Create n clients each firing requests in their own thread, using the same locator

      try
      {

      final int NUM_CLIENTS = 3;

      Thread[] threads = new Thread[NUM_CLIENTS];
      Invoker[] invokers = new Invoker[NUM_CLIENTS];

      Object obj = new Object();

      for (int i = 0; i < NUM_CLIENTS; i++)
      {
         invokers[i] = new Invoker(serverLocator, obj);
         threads[i] = new Thread(invokers[i]);
         threads[i].start();
      }

      synchronized (obj)
      {
         obj.wait();
      }

      for (int i = 0; i < NUM_CLIENTS; i++)
      {
         if (invokers[i].failed)
         {
            fail();
            for (int j = 0; j < NUM_CLIENTS; j++)
            {
               threads[j].interrupt();
            }
         }
      }

      for (int i = 0; i < NUM_CLIENTS; i++)
      {
         threads[i].join();
      }

      for (int i = 0; i < NUM_CLIENTS; i++)
      {
         if (invokers[i].failed)
         {
            fail();
         }
      }
      }
      finally
      {
         serverConnector.stop();
         serverConnector.destroy();
      }
   }
View Full Code Here

            field = Client.class.getDeclaredField("callbackConnectors");
            field.setAccessible(true);
            Map callbackConnectors = (Map)field.get(client);

            InvokerCallbackHandler callbackHandler = remotingConnection.getCallbackManager();
            Connector connector = (Connector)callbackConnectors.get(callbackHandler);
            locator = new InvokerLocator(connector.getInvokerLocator());
            assertEquals(address, locator.getHost());
            assertEquals(freePort, locator.getPort());
         }
         else if ("http".equals(transport))
         {
View Full Code Here

         NetworkRegistry registry = NetworkRegistry.getInstance();
         server.registerMBean(registry, new ObjectName("remoting:type=NetworkRegistry"));

         //int port = PortUtil.findFreePort();

         Connector connector = new Connector();
         connector.setInvokerLocator(locator.getLocatorURI());
         ObjectName obj = new ObjectName("jboss.remoting:type=Connector,transport=" + locator.getProtocol());
         server.registerMBean(connector, obj);

         connector.start();

         connector.addInvocationHandler("test", new TestInvocationHandler());

//          MulticastDetector detector = new MulticastDetector();
//          server.registerMBean(detector, new ObjectName("remoting:type=Detector,transport=multicast"));
//          detector.start();
View Full Code Here

      {

         try
         {
            // Lookup the Connector in MC
            Connector connector = Ejb3RegistrarLocator.locateRegistrar().lookup(OBJECT_NAME_REMOTING_CONNECTOR,
                  Connector.class);

            // Use the binding specified by the Connector
            try
            {
               DEFAULT_CLIENT_BINDING = connector.getInvokerLocator();
            }
            catch (Exception e)
            {
               throw new RuntimeException("Could not obtain " + InvokerLocator.class.getSimpleName()
                     + " from EJB3 Remoting Connector", e);
View Full Code Here

      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("test", invocationHandler);
      connector.start();
   }
View Full Code Here

               {
                  callbackConfig.putAll(locator.getParameters());
               }
              
               configureCallbackServerSocketFactory(callbackConfig);
               Connector callbackServerConnector = new Connector(callbackLocator, callbackConfig);
              
               synchronized (callbackConnectors)
               {
                  Set connectors = (Set) callbackConnectors.get(callbackhandler);
                  if (connectors == null)
                  {
                     connectors = new HashSet();
                  }
                  connectors.add(callbackServerConnector);
                  callbackConnectors.put(callbackhandler, connectors);
               }

               callbackServerConnector.start();
               // have to use the locator from the server as can be modified internally
               callbackLocator = callbackServerConnector.getServerInvoker().getLocator();
               addCallbackListener(callbackhandler, metadata, callbackLocator, callbackHandlerObject);
            }
            else
            {
               if (callbackPollers.get(callbackhandler) != null)
View Full Code Here

            if (connectors != null)
            {
               Iterator it = connectors.iterator();
               while (it.hasNext())
               {
                  Connector callbackConnector = (Connector) it.next();
                  callbackConnector.stop();
                  callbackConnector.destroy();
               }
            }
         }
         else
         {
View Full Code Here

      serverLocator = new InvokerLocator(locatorURI);
      log.info("Starting remoting server with locator uri of: " + locatorURI);
      HashMap config = new HashMap();
      config.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraServerConfig(config);
      connector = new Connector(serverLocator, config);
      connector.create();
      invocationHandler = new TestInvocationHandler();
      connector.addInvocationHandler("test", invocationHandler);
      connector.start();
   }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.Connector

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.