Package org.jboss.remoting

Examples of org.jboss.remoting.Client.invokeOneway()


      // Wait for connection to return to pool.
      Thread.sleep(500);
     
      // This invocation should use the pooled connection and go into the queue.
      log.info("making 3rd oneway invocation");
      client.invokeOneway(SLOW + "3", null, false);
      assertTrue((System.currentTimeMillis() - start < 2000));
      Thread.sleep(2000);
      log.info("handler.count: " + handler.startedCount);
      assertEquals(3, handler.startedCount);
     


      int i = 0;
      try
      {
         for (; i < MAX_POOL_SIZE + 10; i++)
         {
            client.invokeOneway(new Integer(i), null, false);
            log.debug("invocation: " + i);
         }
      }
      catch (Throwable t)
      {

      int i = 0;
      try
      {
         for (; i < MAX_POOL_SIZE + 10; i++)
         {
            client.invokeOneway(new Integer(i), null, true);
            log.debug("invocation: " + i);
         }
      }
      catch (Throwable t)
      {

      Map metadata = new HashMap();
      metadata.put("TYPE", "POST");
      metadata.put("http.basic.username", username);
      metadata.put("http.basic.password", password);
      remotingClient.invokeOneway( "Message payload example(just a String) ", metadata );

      System.out.println("Sent http post to server.");
      Integer responseCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
      String responseMessage = (String) metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
      System.out.println("Response code from server: " + responseCode);

      Client remotingClient = new Client(locator);
      remotingClient.connect();

      Map metadata = new HashMap();
      metadata.put("TYPE", "POST");
      remotingClient.invokeOneway(payload, metadata );

      System.out.println("Sent http post to server.");
      Integer responseCode = (Integer) metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
      String responseMessage = (String) metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
      System.out.println("Response code from server: " + responseCode);

         checkUserAgent(remotingClient, metadata);

         makeExceptionInvocation(remotingClient, metadata);

         remotingClient.invokeOneway("Do something", metadata, true);

         remotingClient.invokeOneway("Do something", metadata, false);
      }
      catch (Throwable throwable)
      {

         makeExceptionInvocation(remotingClient, metadata);

         remotingClient.invokeOneway("Do something", metadata, true);

         remotingClient.invokeOneway("Do something", metadata, false);
      }
      catch (Throwable throwable)
      {
         throw new Exception(throwable);
      }

         MessageAbstraction resMessage = null;

         if (oneway == true)
         {
            client.invokeOneway(reqMessage, metadata, false);
         }
         else
         {
            resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);
         }

      DelayedCallbackHandler callbackHandler = new DelayedCallbackHandler();
      client.addListener(callbackHandler, new InvokerLocator(callbackLocatorURI));
      assertEquals(1, invocationHandler.callbackHandlers.size());
      log.info("client added callback handler");
     
      client.invokeOneway(CALLBACK_TEST);
      client.invokeOneway(CALLBACK_TEST);
      client.invokeOneway(CALLBACK_TEST);
      Thread.sleep(500);
      assertEquals(3, callbackHandler.callbackCounter);
     

      client.addListener(callbackHandler, new InvokerLocator(callbackLocatorURI));
      assertEquals(1, invocationHandler.callbackHandlers.size());
      log.info("client added callback handler");
     
      client.invokeOneway(CALLBACK_TEST);
      client.invokeOneway(CALLBACK_TEST);
      client.invokeOneway(CALLBACK_TEST);
      Thread.sleep(500);
      assertEquals(3, callbackHandler.callbackCounter);
     
      Iterator it = invocationHandler.callbackHandlers.iterator();

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.