Examples of ClientInvoker


Examples of org.jboss.remoting.transport.ClientInvoker

         Client client = new Client(locator, cconfig);
         client.connect();
        
         // Set SocketFactory in ClientInvoker.
         SocketFactory sf4 = getDefaultSocketFactory();
         ClientInvoker clientInvoker = client.getInvoker();
         clientInvoker.setSocketFactory(sf4);
        
         // Verify SocketFactory is the one set in ClientInvoker.
         assertTrue(sf4 == clientInvoker.getSocketFactory());
        
        
         //////////////////////////////////////////////
         /////     Do server side callback test.   ////
         //////////////////////////////////////////////
         Thread.sleep(500);
         freeport = PortUtil.findFreePort(getHostName());
         InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         HashMap config = new HashMap();
         addExtraCallbackConfig(config);
         Connector callbackConnector = new Connector(callbackLocator.getLocatorURI(), config);
         ServerSocketFactory ssf3 = getDefaultCallbackServerSocketFactory();
         callbackConnector.setServerSocketFactory(ssf3);
         callbackConnector.create();
         callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
         callbackConnector.start();
        
         CallbackHandler callbackHandler = new CallbackHandler();
         String callbackHandleObject = "myCallbackHandleObject";
         client.addListener(callbackHandler, callbackLocator, callbackHandleObject);
        
         // Verify that callback succeeded.
         assertEquals(1, callbackHandler.getCallbacks().size());
        
         // Verify callback SocketFactory is the one set in SocketInvoker.
         Field field = ServerInvoker.class.getDeclaredField("handlers");
         field.setAccessible(true);
         Map handlers = (Map) field.get(serverInvoker);
         Object obj = handlers.values().iterator().next();
         SampleInvocationHandler sampleInvocationHandler = (SampleInvocationHandler) obj;
         obj = sampleInvocationHandler.getCallbackHandler();
         ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) obj;
         field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
         field.setAccessible(true);
         Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
         ClientInvoker callbackClientInvoker = callbackClient.getInvoker();
         assertTrue(sf2 == callbackClientInvoker.getSocketFactory());
        
         client.disconnect();
         callbackConnector.stop();
         connector.stop();
         log.info(getName() + " PASSES");
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

         SocketFactory sf4 = getDefaultSocketFactory();
         client.setSocketFactory(sf4);
         client.connect();
        
         // Verify SocketFactory is the one set in Client.
         ClientInvoker clientInvoker = client.getInvoker();
         assertTrue(sf4 == clientInvoker.getSocketFactory());
        
        
         //////////////////////////////////////////////
         /////     Do server side callback test.   ////
         //////////////////////////////////////////////
         Thread.sleep(500);
         freeport = PortUtil.findFreePort(getHostName());
         InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         HashMap config = new HashMap();
         addExtraCallbackConfig(config);
         Connector callbackConnector = new Connector(callbackLocator.getLocatorURI(), config);
         ServerSocketFactory ssf3 = getDefaultCallbackServerSocketFactory();
         callbackConnector.setServerSocketFactory(ssf3);
         callbackConnector.create();
         callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
         callbackConnector.start();
        
         CallbackHandler callbackHandler = new CallbackHandler();
         String callbackHandleObject = "myCallbackHandleObject";
         client.addListener(callbackHandler, callbackLocator, callbackHandleObject);
        
         // Verify that callback succeeded.
         assertEquals(1, callbackHandler.getCallbacks().size());
        
         // Verify callback SocketFactory is the one set in Connector.
         Field field = ServerInvoker.class.getDeclaredField("handlers");
         field.setAccessible(true);
         Map handlers = (Map) field.get(serverInvoker);
         Object obj = handlers.values().iterator().next();
         SampleInvocationHandler sampleInvocationHandler = (SampleInvocationHandler) obj;
         obj = sampleInvocationHandler.getCallbackHandler();
         ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) obj;
         field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
         field.setAccessible(true);
         Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
         ClientInvoker callbackClientInvoker = callbackClient.getInvoker();
         assertTrue(sf2 == callbackClientInvoker.getSocketFactory());
        
         client.disconnect();
         callbackConnector.stop();
         connector.stop();
         log.info(getName() + " PASSES");
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

         InvokerLocator locator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         Client client = new Client(locator, cconfig);
         client.connect();

         // Verify SocketFactory is the one passed in config map.
         ClientInvoker clientInvoker = client.getInvoker();
         assertTrue(sf2 == clientInvoker.getSocketFactory());
        
        
         //////////////////////////////////////////////
         /////     Do server side callback test.   ////
         //////////////////////////////////////////////
         Thread.sleep(500);
         freeport = PortUtil.findFreePort(getHostName());
         InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         HashMap config = new HashMap();
         addExtraCallbackConfig(config);
         Connector callbackConnector = new Connector(callbackLocator.getLocatorURI(), config);
         ServerSocketFactory ssf3 = getDefaultCallbackServerSocketFactory();
         callbackConnector.setServerSocketFactory(ssf3);
         callbackConnector.create();
         callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
         callbackConnector.start();
        
         CallbackHandler callbackHandler = new CallbackHandler();
         String callbackHandleObject = "myCallbackHandleObject";
         client.addListener(callbackHandler, callbackLocator, callbackHandleObject);
        
         // Verify that callback succeeded.
         assertEquals(1, callbackHandler.getCallbacks().size());
        
         // Verify callback SocketFactory is the one passed in config map.
         Field field = ServerInvoker.class.getDeclaredField("handlers");
         field.setAccessible(true);
         Map handlers = (Map) field.get(serverInvoker);
         Object obj = handlers.values().iterator().next();
         SampleInvocationHandler sampleInvocationHandler = (SampleInvocationHandler) obj;
         obj = sampleInvocationHandler.getCallbackHandler();
         ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) obj;
         field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
         field.setAccessible(true);
         Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
         ClientInvoker callbackClientInvoker = callbackClient.getInvoker();
         assertTrue(sf1 == callbackClientInvoker.getSocketFactory());
        
         client.disconnect();
         callbackConnector.stop();
         connector.stop();
         log.info(getName() + " PASSES");
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

         InvokerLocator locator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         Client client = new Client(locator, cconfig);
         client.connect();

         // Verify SocketFactory is the one passed in config map.
         ClientInvoker clientInvoker = client.getInvoker();
         assertTrue(getUniqueSocketFactoryClass() == clientInvoker.getSocketFactory().getClass());
        
        
         //////////////////////////////////////////////
         /////     Do server side callback test.   ////
         //////////////////////////////////////////////
         Thread.sleep(500);
         freeport = PortUtil.findFreePort(getHostName());
         InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         HashMap config = new HashMap();
         addExtraCallbackConfig(config);
         Connector callbackConnector = new Connector(callbackLocator.getLocatorURI(), config);
         ServerSocketFactory ssf3 = getDefaultCallbackServerSocketFactory();
         callbackConnector.setServerSocketFactory(ssf3);
         callbackConnector.create();
         callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
         callbackConnector.start();
        
         CallbackHandler callbackHandler = new CallbackHandler();
         String callbackHandleObject = "myCallbackHandleObject";
         client.addListener(callbackHandler, callbackLocator, callbackHandleObject);
        
         // Verify that callback succeeded.
         assertEquals(1, callbackHandler.getCallbacks().size());
        
         // Verify callback SocketFactory is the one passed in config map.
         Field field = ServerInvoker.class.getDeclaredField("handlers");
         field.setAccessible(true);
         Map handlers = (Map) field.get(serverInvoker);
         Object obj = handlers.values().iterator().next();
         SampleInvocationHandler sampleInvocationHandler = (SampleInvocationHandler) obj;
         obj = sampleInvocationHandler.getCallbackHandler();
         ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) obj;
         field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
         field.setAccessible(true);
         Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
         ClientInvoker callbackClientInvoker = callbackClient.getInvoker();
         assertTrue(getUniqueCallbackSocketFactoryClass() ==
                    callbackClientInvoker.getSocketFactory().getClass());
        
         client.disconnect();
         callbackConnector.stop();
         connector.stop();
         log.info(getName() + " PASSES");
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

        
         Client client = new Client(locator, cconfig);
         client.connect();

         // Verify SocketFactory is the one passed in config map.
         ClientInvoker clientInvoker = client.getInvoker();
         assertTrue(getUniqueSocketFactoryClass() == clientInvoker.getSocketFactory().getClass());
        
        
         //////////////////////////////////////////////
         /////     Do server side callback test.   ////
         //////////////////////////////////////////////
         Thread.sleep(500);
         freeport = PortUtil.findFreePort(getHostName());
         InvokerLocator callbackLocator = new InvokerLocator(getTransport() + "://" + getHostName() + ":" + freeport);
         HashMap config = new HashMap();
         addExtraCallbackConfig(config);
         Connector callbackConnector = new Connector(callbackLocator.getLocatorURI(), config);
         ServerSocketFactory ssf3 = getDefaultCallbackServerSocketFactory();
         callbackConnector.setServerSocketFactory(ssf3);
         callbackConnector.create();
         callbackConnector.addInvocationHandler("sample", new SampleInvocationHandler());
         callbackConnector.start();
        
         CallbackHandler callbackHandler = new CallbackHandler();
         String callbackHandleObject = "myCallbackHandleObject";
         client.addListener(callbackHandler, callbackLocator, callbackHandleObject);
        
         // Verify that callback succeeded.
         assertEquals(1, callbackHandler.getCallbacks().size());
        
         // Verify callback SocketFactory is the one passed in config map.
         Field field = ServerInvoker.class.getDeclaredField("handlers");
         field.setAccessible(true);
         Map handlers = (Map) field.get(serverInvoker);
         Object obj = handlers.values().iterator().next();
         SampleInvocationHandler sampleInvocationHandler = (SampleInvocationHandler) obj;
         obj = sampleInvocationHandler.getCallbackHandler();
         ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) obj;
         field = ServerInvokerCallbackHandler.class.getDeclaredField("callBackClient");
         field.setAccessible(true);
         Client callbackClient = (Client) field.get(serverInvokerCallbackHandler);
         ClientInvoker callbackClientInvoker = callbackClient.getInvoker();
         assertTrue(getUniqueCallbackSocketFactoryClass() ==
                    callbackClientInvoker.getSocketFactory().getClass());
        
         client.disconnect();
         callbackConnector.stop();
         connector.stop();
         log.info(getName() + " PASSES");
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

         if (trace)
         {
            log.trace("destroying client invoker " + locator + ", config " + configuration);
         }

         ClientInvoker invoker = decrementClientInvokerCounter(locator, configuration);

         if(invoker != null)
         {
            if (trace)
            {
               log.trace("disconnecting " + invoker);
            }
            invoker.disconnect();
            invoker = null;
         }
      }
   }
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

      {
         throw new NullPointerException("locator cannot be null");
      }
      synchronized(clientLock)
      {
         ClientInvoker invoker = getRegisteredClientInvoker(locator, configuration);
         if(invoker != null)
         {
            if(trace) { log.trace("Found and returning cached client invoker (" + invoker + ")"); }
            return invoker;
         }

         boolean isForceRemote = false;
         boolean isPassByValue = false;
         Map parameters = locator.getParameters();
         if(parameters != null)
         {
            String value = (String) parameters.get(InvokerLocator.BYVALUE);
            if(value != null && Boolean.valueOf(value).booleanValue())
            {
               isPassByValue = true;
            }
            value = (String) parameters.get(InvokerLocator.FORCE_REMOTE);
            if(value != null && Boolean.valueOf(value).booleanValue())
            {
               isForceRemote = true;
            }
         }
         // configuration map will override locator params
         if(configuration != null)
         {
            String value = (String) configuration.get(InvokerLocator.BYVALUE);
            if(value != null && Boolean.valueOf(value).booleanValue())
            {
               isPassByValue = true;
            }
            value = (String) configuration.get(InvokerLocator.FORCE_REMOTE);
            if(value != null && Boolean.valueOf(value).booleanValue())
            {
               isForceRemote = true;
            }
         }

         // Check to see if server invoker is local
         // If in server locators map, then created locally by this class
         ServerInvoker svrInvoker = null;
         if (!isForceRemote)
         {
            synchronized (serverLock)
            {
               svrInvoker = (ServerInvoker) serverLocators.get(locator);
            }
            if(svrInvoker != null)
            {
               LocalClientInvoker localInvoker = new LocalClientInvoker(locator, configuration, isPassByValue);
               // have to set reference to local server invoker so client in invoke directly
               localInvoker.setServerInvoker(svrInvoker);
               invoker = localInvoker;
               InvokerLocator l = invoker.getLocator();

               addRegisteredClientInvoker(invoker, l, configuration);
            }
         }
        
         if (svrInvoker == null) //not local
         {
            String protocol = locator.getProtocol();
            if(protocol == null)
            {
               throw new NullPointerException("protocol cannot be null for the locator");
            }

            invoker = loadClientInvoker(protocol, locator, configuration);

            InvokerLocator l = invoker.getLocator();

            addRegisteredClientInvoker(invoker, l, configuration);
         }
         return invoker;
      }
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

    * @param locator
    * @param configuration
    */
   private static ClientInvoker getRegisteredClientInvoker(InvokerLocator locator, Map configuration)
   {
      ClientInvoker invoker = null;

      List holderList = (List) clientLocators.get(locator);
      if (holderList != null)
      {
         for (int x = 0; x < holderList.size(); x++)
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

      holder.incrementCount();
   }

   private static ClientInvoker loadClientInvoker(String protocol, InvokerLocator locator, Map configuration) throws Exception
   {
      ClientInvoker clientInvoker = null;

      Class transportFactoryClass = getTransportClientFactory(protocol);
      if(transportFactoryClass != null)
      {
         ClientFactory transportFactory = (ClientFactory)transportFactoryClass.newInstance();
View Full Code Here

Examples of org.jboss.remoting.transport.ClientInvoker

         log.debug("Could not decrement client invoker counter for locator " + locator +
                   "as does not exist in invoker registry with matching configuraion map.");
         return null;
      }

      ClientInvoker clientInvoker =  null;
      holder.decrementCount();

      if(holder.getCount() == 0)
      {
         clientInvoker = holder.getClientInvoker();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.