Package org.jboss.remoting

Examples of org.jboss.remoting.Client


      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();     
View Full Code Here


      {        
         remotingConnection = new JMSRemotingConnection(serverLocatorURI, clientPing);
        
         remotingConnection.start();
  
         Client client = remotingConnection.getRemotingClient();
        
         String remotingSessionId = client.getSessionId();
        
         String clientVMId = JMSClientVMIdentifier.instance;
           
         ConnectionFactoryCreateConnectionDelegateRequest req =
            new ConnectionFactoryCreateConnectionDelegateRequest(id, v,
                                                                 remotingSessionId, clientVMId,
                                                                 username, password, failedNodeID);
          
         ResponseSupport rs = (ResponseSupport)client.invoke(req, null);
        
         res = (CreateConnectionResult)rs.getResponse();
      }
      catch (Throwable t)
      {
View Full Code Here

      configuration.put(Client.ENABLE_LEASE, String.valueOf(false));

      //We execute this on its own client
     
      Client theClient = createClient();
     
      ConnectionFactoryGetClientAOPStackRequest req =
         new ConnectionFactoryGetClientAOPStackRequest(id, v);
     
      return (byte[])doInvoke(theClient, req);
View Full Code Here

      Map configuration = new HashMap();

      configuration.put(Client.ENABLE_LEASE, String.valueOf(false));

      //We execute this on it's own client
      Client client;
     
      try
      {
         client = new Client(new InvokerLocator(serverLocatorURI), configuration);
         client.setSubsystem(ServerPeer.REMOTING_JMS_SUBSYSTEM);
         client.connect();
      }
      catch (Exception e)
      {
         throw new MessagingNetworkFailureException("Failed to connect client", e);
      }

      client.setMarshaller(new JMSWireFormat());
      client.setUnMarshaller(new JMSWireFormat());
     
      return client;
   }
View Full Code Here

      this.serverPeer.getConnectionManager().
         registerConnection(jmsClientVMID, remotingClientSessionID, this);
     
      this.callbackHandler = callbackHandler;
     
      Client callbackClient = callbackHandler.getCallbackClient();
     
      if (callbackClient != null)
      {
         // TODO not sure if this is the best way to do this, but the callbackClient needs to have
         //      its "subsystem" set, otherwise remoting cannot find the associated
         //      ServerInvocationHandler on the callback server
         callbackClient.setSubsystem(CallbackManager.JMS_CALLBACK_SUBSYSTEM);
        
         // We explictly set the Marshaller since otherwise remoting tries to resolve the marshaller
         // every time which is very slow - see org.jboss.remoting.transport.socket.ProcessInvocation
         // This can make a massive difference on performance. We also do this in
         // JMSRemotingConnection.setupConnection
        
         callbackClient.setMarshaller(new JMSWireFormat());
         callbackClient.setUnMarshaller(new JMSWireFormat());
      }
      else
      {
         log.debug("ServerInvokerCallbackHandler callback Client is not available: " +
                   "must be using pull callbacks");
View Full Code Here

         }

         // We send the message to the client on the current thread. The message is written onto the
         // transport and then the thread returns immediately without waiting for a response.

         Client callbackClient = callbackHandler.getCallbackClient();

         ClientDelivery del = new ClientDelivery(message, id, deliveryId, ref.getDeliveryCount());

         Callback callback = new Callback(del);

         try
         {
            // FIXME - due a design (flaw??) in the socket based transports, they use a pool of TCP
            // connections, so subsequent invocations can end up using different underlying
            // connections meaning that later invocations can overtake earlier invocations, if there
            // are more than one user concurrently invoking on the same transport. We need someway
            // of pinning the client object to the underlying invocation. For now we just serialize
            // all access so that only the first connection in the pool is ever used - bit this is
            // far from ideal!!!
            // See http://jira.jboss.com/jira/browse/JBMESSAGING-789

            Object invoker = null;

            if (callbackClient != null)
            {
               invoker = callbackClient.getInvoker();
                             
            }
            else
            {
               // TODO: dummy synchronization object, in case there's no clientInvoker. This will
View Full Code Here

      Map config = new HashMap();
     
      config.put(Client.ENABLE_LEASE, String.valueOf(clientPing));

      client = new Client(serverLocator, config);

      client.setSubsystem(ServerPeer.REMOTING_JMS_SUBSYSTEM);

      if (log.isTraceEnabled()) { log.trace(this + " created client"); }
View Full Code Here

      {
         try
         {
            for (int i = 0; i < 5000; i++)
            {
               Client cl = new Client(locator);
               cl.connect();
               cl.invoke("aardvark");
               cl.disconnect();
            }
            synchronized (o)
            {
               o.notify();
            }
View Full Code Here

      if (!isRemote())
      {
         fail("This test should be run in a remote configuration!");
      }

      Client client = null;
      ObjectName subsystemService = null;

      try
      {
         subsystemService = RemotingTestSubsystemService.deployService();

         client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);

         client.connect();

         client.invokeOneway("blip");

         // make sure invocation reached the target subsystem

         InvocationRequest i =
            RemotingTestSubsystemService.getNextInvocationFromServer(subsystemService, 2000);

         assertNotNull(i);
         assertEquals("blip", i.getParameter());
      }
      finally
      {
         if (client != null)
         {
            client.disconnect();
         }

         RemotingTestSubsystemService.undeployService(subsystemService);
      }
   }
View Full Code Here

      if (!isRemote())
      {
         fail("This test should be run in a remote configuration!");
      }

      Client client = null;
      ObjectName subsystemService = null;

      try
      {
         subsystemService = RemotingTestSubsystemService.deployService();

         client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL);

         client.connect();

         // send a ton of invocations
         int COUNT = 200;

         for(int i = 0; i < COUNT; i++)
         {
            client.invokeOneway("ignore");
         }

         // wait a bit until all invocations are flushed from the server-side pool
         Thread.sleep(5000);
      }
      finally
      {
         if (client != null)
         {
            client.disconnect();
         }

         RemotingTestSubsystemService.undeployService(subsystemService);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.Client

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.