Package org.jboss.remoting

Examples of org.jboss.remoting.Client$InvokerDestructionTimerTask


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

      Client client = null;
      ObjectName subsystemService = null;
      SimpleCallbackHandler callbackHandler = null;

      try
      {
         subsystemService = RemotingTestSubsystemService.deployService();

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

         callbackHandler = new SimpleCallbackHandler();

         client.connect();

         client.addListener(callbackHandler, null, null, true);

         client.invoke(new OnewayCallbackTrigger("blop"));

         // make sure we get the callback

         Callback c = callbackHandler.getNextCallback(3000);

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

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


         connection = (JBossConnection)cf.createConnection();
         connection.start();

         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
         Client client = remotingConnection.getRemotingClient();

         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
         field.setAccessible(true);
         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
         String transport = locator.getProtocol();
View Full Code Here

         connection = (JBossConnection)cf.createConnection();
         connection.start();

         ClientConnectionDelegate delegate = (ClientConnectionDelegate)connection.getDelegate();
         JMSRemotingConnection remotingConnection = delegate.getRemotingConnection();
         Client client = remotingConnection.getRemotingClient();

         Field field = JMSRemotingConnection.class.getDeclaredField("serverLocator");
         field.setAccessible(true);
         InvokerLocator locator = (InvokerLocator)field.get(remotingConnection);
         String transport = locator.getProtocol();
View Full Code Here

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

      Client client = new Client(serverLocator);

      client.connect();

      SimpleConnectionListener connListener = new SimpleConnectionListener();
      client.addConnectionListener(connListener, 50);

      assertEquals(50, client.getPingPeriod());

      // let it ping for a while

      log.info("pinging for 60 seconds with a rate of a ping per 50 ms ...");
      Thread.sleep(60000);
View Full Code Here

      if (!"socket".equals(ServerManagement.getRemotingTransport(0)))
      {
         return;
      }

      Client client = null;

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

         client.connect();

         SimpleConnectionListener connListener = new SimpleConnectionListener();
         client.addConnectionListener(connListener, 3333);

         log.info("connection listener added, pinging will start in 3.3 secs");

         Thread.sleep(5000);

         log.info("first ping is done, send a long running invocation");

         // in 2.2.0.Alpha6 the client will send the invocation over a socket configured to time
         // out after 1000 ms, so this will throw java.net.SocketTimeoutException

         client.invoke(new Long(5000));

         Thread.sleep(7000);
      }
      finally
      {
         if (client != null)
         {
            client.disconnect();
         }
      }
   }
View Full Code Here

      if (!"socket".equals(ServerManagement.getRemotingTransport(0)))
      {
         return;
      }

      Client client = null;

      try
      {
         // create a "business" client

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

         client.connect();

         final Client clientCopy = client;

         // send a "long running" invocation first on a separate thread, so we can setup the
         // connection validator at the same time

         new Thread(new Runnable()
         {
            public void run()
            {
               try
               {
                  // this invocation will take 5 secs to complete
                  clientCopy.invoke(new Long(5000));
               }
               catch(Throwable t)
               {
                  log.error("invocation failed", t);
               }
View Full Code Here

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

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

      client.connect();

      client.invoke("blah");

      assertEquals("blah", RemotingTestSubsystemService.
         getNextInvocationFromServer(subsystemService, 2000).getParameter());

      ServerManagement.kill(0);

      // wait a bit for the server to go down

      Thread.sleep(3000);

      // send another invocation

      try
      {
         client.invoke("bloh");
         fail("This should have failed!");
      }
      catch(CannotConnectException e)
      {
         // This happens for HTTP clients - if the client throws CannotConnectException, we're fine,
View Full Code Here

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

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

      client.connect();

      ServerManagement.kill(0);

      // wait a bit for the server to go down

      Thread.sleep(3000);

      // send the first invocation

      try
      {
         client.invoke("bleh");
         fail("This should have failed!");
      }
      catch(CannotConnectException e)
      {
         // if the client throws CannotConnectException, we're fine, this is our
View Full Code Here

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

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

      client.connect();

      SimpleConnectionListener connListener = new SimpleConnectionListener();
      client.addConnectionListener(connListener);

      ServerManagement.kill(0);

      long pingPeriod = client.getPingPeriod();

      // wait for the failure to be detected

      Throwable failure = connListener.getNextFailure(2 * pingPeriod);
      assertNotNull(failure);

      // the client is in a "broken" state, an invocation on it should fail

      try
      {
         client.invoke("bluh");
         fail("this should've failed!");
      }
      catch(CannotConnectException e)
      {
         // this is what a broken client is supposed to throw.
View Full Code Here

      // enable leasing on client
      Map conf = new HashMap();
      conf.put(Client.ENABLE_LEASE, Boolean.TRUE);
      conf.put(InvokerLocator.CLIENT_LEASE_PERIOD, "999");

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

      client.connect();

      long leasePeriod = client.getLeasePeriod();

      assertEquals(999, leasePeriod);

      ServerManagement.kill(0);

      // wait long enough so we get into lease pinging trouble, send around 5 pings; the lease
      // pinger will still be pinging, thinking that the server is up. In my opinion, this is a
      // Remoting design flaw, but we can work around from Messaging, so it's ok. I am using this
      // test to detect a change in behavior of future remoting releases.

      int i = 0;
      long upperLimit = System.currentTimeMillis() + 5 * leasePeriod;
      while(System.currentTimeMillis() < upperLimit)
      {
         i++;
         assertEquals("attempt " + i, 999, client.getLeasePeriod());
         Thread.sleep(1000);
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.remoting.Client$InvokerDestructionTimerTask

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.