Package org.jboss.remoting.transport

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;
         }

         Map orginalConfiguration = null;
         if(configuration != null)
         {
            orginalConfiguration = new HashMap(configuration);
         }
        
         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, orginalConfiguration);
            }
         }
        
         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, orginalConfiguration);
         }
         return invoker;
      }
View Full Code Here


    * @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

      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

         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

   public static boolean checkConnection(InvokerLocator locator, Map config) throws Throwable
   {
      boolean pingWorked = false;
      Map configMap = createPingConfig(config, null);
      int pingTimeout = Integer.parseInt((String) configMap.get(ServerInvoker.TIMEOUT));
      ClientInvoker innerClientInvoker = null;

      try
      {
         innerClientInvoker = InvokerRegistry.createClientInvoker(locator, configMap);

         if (!innerClientInvoker.isConnected())
         {
            if (trace) { log.trace("inner client invoker not connected, connecting ..."); }
            innerClientInvoker.connect();
         }

         pingWorked = doCheckConnection(innerClientInvoker, pingTimeout);
      }
      catch (Throwable throwable)
      {
            log.debug("ConnectionValidator unable to connect to server " +
            innerClientInvoker.getLocator().getProtocol() + "://" +
            innerClientInvoker.getLocator().getHost() + ":" +
            innerClientInvoker.getLocator().getPort(), throwable);
      }
      finally
      {
         if (innerClientInvoker != null)
         {
View Full Code Here

         getParametersFromMap(client.getInvoker().getLocator().getParameters());
      }
      getParametersFromMap(client.getConfiguration());
      getParametersFromMap(metadata);
     
      ClientInvoker clientInvoker = client.getInvoker();
      if (clientInvoker instanceof MicroRemoteClientInvoker)
      {
         sharedInvoker = (MicroRemoteClientInvoker) clientInvoker;
         invokerSessionId = sharedInvoker.getSessionId();
      }
View Full Code Here

            {
               log.warn(this + " could not convert " + STOP_LEASE_ON_FAILURE + " value" +
               " to a boolean: must be a String");
            }
         }
         ClientInvoker invoker = client.getInvoker();
         if (invoker == null)
         {
            if (trace) log.trace(this + " client invoker == null");
         }
         else
         {
            if (trace) log.trace(this + " InvokerLocator: " + invoker.getLocator());
         }
         o = config.get(FAILURE_DISCONNECT_TIMEOUT);
         if (trace) log.trace(this + " \"failureDisconnectTimeout\" set to " + o);
         if (o != null)
         {
View Full Code Here

         configMap = new HashMap(config);
      }
      configMap.put("connection_checker", "true");
      configMap.put("timeout", "1000");
      configMap.put("NumberOfRetries", "1");
      ClientInvoker innerClientInvoker = null;

      try
      {
         innerClientInvoker = InvokerRegistry.createClientInvoker(locator, configMap);

         if (!innerClientInvoker.isConnected())
         {
            if (trace) { log.trace("inner client invoker not connected, connecting ..."); }
            innerClientInvoker.connect();
         }

         pingWorked = doCheckConnection(innerClientInvoker);
      }
      catch (Throwable throwable)
      {
         log.debug("ConnectionValidator to connect to server " +
            innerClientInvoker.getLocator().getProtocol() + "://" +
            innerClientInvoker.getLocator().getHost() + ":" +
            innerClientInvoker.getLocator().getPort(), throwable);
      }
      finally
      {
         if (innerClientInvoker != null)
         {
View Full Code Here

   public static boolean checkConnection(InvokerLocator locator, Map config) throws Throwable
   {
      boolean pingWorked = false;
      Map configMap = createPingConfig(config, null);
      int pingTimeout = Integer.parseInt((String) configMap.get(ServerInvoker.TIMEOUT));
      ClientInvoker innerClientInvoker = null;

      try
      {
         innerClientInvoker = InvokerRegistry.createClientInvoker(locator, configMap);

         if (!innerClientInvoker.isConnected())
         {
            if (trace) { log.trace("inner client invoker not connected, connecting ..."); }
            innerClientInvoker.connect();
         }

         pingWorked = doCheckConnection(innerClientInvoker, pingTimeout);
      }
      catch (Throwable throwable)
      {
         log.debug("ConnectionValidator to connect to server " +
            innerClientInvoker.getLocator().getProtocol() + "://" +
            innerClientInvoker.getLocator().getHost() + ":" +
            innerClientInvoker.getLocator().getPort(), throwable);
      }
      finally
      {
         if (innerClientInvoker != null)
         {
View Full Code Here

         getParametersFromMap(client.getInvoker().getLocator().getParameters());
      }
      getParametersFromMap(client.getConfiguration());
      getParametersFromMap(metadata);
     
      ClientInvoker clientInvoker = client.getInvoker();
      if (clientInvoker instanceof MicroRemoteClientInvoker)
      {
         invokerSessionId = ((MicroRemoteClientInvoker) clientInvoker).getSessionId();
      }
      else
View Full Code Here

TOP

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

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.