Package org.jboss.remoting

Examples of org.jboss.remoting.LeasePinger


      Client client = new Client(clientLocator, clientConfig);
      TestConnectionListener clientConnectionListener = new TestConnectionListener("clientConnectionListener");
      client.connect(clientConnectionListener, null);
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger leasePinger1 = (LeasePinger) field.get(client.getInvoker());
      log.info("client is connected");
     
      // Test connection.
      assertEquals("abc", client.invoke("abc"));
      log.info("connection is good");
View Full Code Here


      log.info("entering " + getName());
     
      setupServer();
      SocketClientInvoker clientInvoker = new SocketClientInvoker(serverLocator);
      clientInvoker.connect();
      LeasePinger leasePinger = new LeasePinger(clientInvoker, "abc", 2000);
      log.info("expect WARN \"failed to ping to server\"");
      Method method = LeasePinger.class.getDeclaredMethod("setLeasePingerId", new Class[]{String.class});
      method.setAccessible(true);
      method.invoke(leasePinger, new Object[]{"dummyID"});
      leasePinger.addClient("def", null, 1000);
     
      // Verify LeasePingerTimerTask has not been created.
      Field field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(leasePinger);
      assertNull(timerTask);
      leasePinger.startPing();
      timerTask = (TimerTask) field.get(leasePinger);
      assertNotNull(timerTask);
     
      // Verify new LeasePingerTimerTask gets created when adding new Client
      // with shorter lease period.
      leasePinger.addClient("ghi", null, 500);
      TimerTask newTimerTask = (TimerTask) field.get(leasePinger);
      assertNotSame(newTimerTask, timerTask);
     
      log.info(getName() + " PASSES");
   }
View Full Code Here

         client.addListener(callbackHandler, null, null, true);
      }
     
      field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(client.getInvoker());
      field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(pinger);
      timerTask.cancel();
     
View Full Code Here

   {
      log.info("entering " + getName());
     
      InvokerLocator locator = new InvokerLocator("socket://localhost:8888");
      SocketClientInvoker clientInvoker = new SocketClientInvoker(locator);
      LeasePinger leasePinger = new LeasePinger(clientInvoker, "abc", 2000);
      log.info("expect WARN \"failed to ping to server\"");
      leasePinger.addClient("def", null, 1000);
     
      // Verify LeasePingerTimerTask has not been created.
      Field field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(leasePinger);
      assertNull(timerTask);
      leasePinger.startPing();
      timerTask = (TimerTask) field.get(leasePinger);
      assertNotNull(timerTask);
     
      // Verify new LeasePingerTimerTask gets created when adding new Client
      // with shorter lease period.
      leasePinger.addClient("ghi", null, 500);
      TimerTask newTimerTask = (TimerTask) field.get(leasePinger);
      assertNotSame(newTimerTask, timerTask);
     
      log.info(getName() + " PASSES");
   }
View Full Code Here

   {
      log.info("entering " + getName());
     
      InvokerLocator locator = new InvokerLocator("socket://localhost:8888");
      SocketClientInvoker clientInvoker = new SocketClientInvoker(locator);
      LeasePinger leasePinger = new LeasePinger(clientInvoker, "abc", 2000);
      log.info("expect WARN \"failed to ping to server\"");
      leasePinger.addClient("def", null, 1000);
     
      // Verify LeasePingerTimerTask has not been created.
      Field field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(leasePinger);
      assertNull(timerTask);
      leasePinger.startPing();
      timerTask = (TimerTask) field.get(leasePinger);
      assertNotNull(timerTask);
     
      // Verify new LeasePingerTimerTask gets created when adding new Client
      // with shorter lease period.
      leasePinger.addClient("ghi", null, 500);
      TimerTask newTimerTask = (TimerTask) field.get(leasePinger);
      assertNotSame(newTimerTask, timerTask);
     
      log.info(getName() + " PASSES");
   }
View Full Code Here

     
      // 1. Kill LeasePinger for Client 1.
      ClientInvoker invoker = client1.getInvoker();
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(invoker);
      field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(pinger);
      timerTask.cancel();
      log.info("stopped LeasePinger");
View Full Code Here

     
      // 1. Kill LeasePinger.
      ClientInvoker invoker = client.getInvoker();
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(invoker);
      field = LeasePinger.class.getDeclaredField("timerTask");
      field.setAccessible(true);
      TimerTask timerTask = (TimerTask) field.get(pinger);
      timerTask.cancel();
      log.info("stopped LeasePinger");
View Full Code Here

      Client client = new Client(clientLocator, clientConfig);
      TestConnectionListener clientConnectionListener = new TestConnectionListener("clientConnectionListener");
      client.connect(clientConnectionListener, null);
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger leasePinger1 = (LeasePinger) field.get(client.getInvoker());
      log.info("client is connected");
     
      // Test connection.
      assertEquals("abc", client.invoke("abc"));
      log.info("connection is good");
View Full Code Here

     
      // Get LeasePinger.
      MicroRemoteClientInvoker clientInvoker = (MicroRemoteClientInvoker) client.getInvoker();
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
     
      // Prevent server from answering PINGs.
      SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
      field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
View Full Code Here

     
      // Get LeasePinger.
      MicroRemoteClientInvoker clientInvoker = (MicroRemoteClientInvoker) client.getInvoker();
      Field field = MicroRemoteClientInvoker.class.getDeclaredField("leasePinger");
      field.setAccessible(true);
      LeasePinger pinger = (LeasePinger) field.get(clientInvoker);
     
      // Prevent server from answering PINGs.
      SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
      field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
View Full Code Here

TOP

Related Classes of org.jboss.remoting.LeasePinger

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.