Package org.jboss.remoting

Examples of org.jboss.remoting.ServerInvoker$CallbackContainer


      client.addListener(callbackHandler, new HashMap());
      log.info("client added callback handler");
      client.invoke(CALLBACK_TEST);
      assertEquals(1, callbackHandler.callbackCounter);
     
      ServerInvoker serverInvoker = connector.getServerInvoker();
      assertTrue(serverInvoker instanceof BisocketServerInvoker);
      Field field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      Map callbackHandlers = (Map) field.get(serverInvoker);
      assertEquals(1, callbackHandlers.size());
View Full Code Here


      Map callbackConnectors = (Map) field.get(client);
      assertEquals(1, callbackConnectors.size());
      Set callbackConnectorSet = (Set) callbackConnectors.values().iterator().next();
      assertEquals(1, callbackConnectorSet.size());
      Connector callbackConnector = (Connector) callbackConnectorSet.iterator().next();
      ServerInvoker cbsi = callbackConnector.getServerInvoker();
      assertTrue(cbsi instanceof BisocketServerInvoker);
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(cbsi);
      assertEquals(1, controlConnectionThreadMap.size());
      Thread t = (Thread) controlConnectionThreadMap.values().iterator().next();
      Class[] classes = BisocketServerInvoker.class.getDeclaredClasses();
      Class controlConnectionThreadClass = null;
     
      for (int i = 0; i < classes.length; i++)
      {
         log.info(classes[i]);
         String fqn = classes[i].getName();
         String className = fqn.substring(fqn.lastIndexOf('.') + 1);
         log.info(className);
         if ("BisocketServerInvoker$ControlConnectionThread".equals(className))
         {
            controlConnectionThreadClass = classes[i];
            break;
         }
      }
     
      assertNotNull(controlConnectionThreadClass);
      assertEquals(t.getClass(), controlConnectionThreadClass);
      field = controlConnectionThreadClass.getDeclaredField("controlSocket");
      field.setAccessible(true);
      Socket controlSocket = (Socket) field.get(t);
      assertNotNull(controlSocket);
      controlSocket.close();
      log.info("CLOSED CONTROL SOCKET");
     
      // Shut down the only existing ServerThread on the server side, and therefore
      // the only existing pooled connection on the client side, forcing the
      // next invocation to depend on the creation of a new control connection.
      field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      ServerInvoker serverInvoker = connector.getServerInvoker();
      assertTrue(serverInvoker instanceof BisocketServerInvoker);
      LRUPool clientpool = (LRUPool) field.get(serverInvoker);
      Set serverThreads = clientpool.getContents();
      assertEquals(1, serverThreads.size());
      ((ServerThread)serverThreads.iterator().next()).shutdown();
View Full Code Here

      log.info("RESTARTED CONNECTOR");
     
      // Wait until a failure has been detected on the control connection.
      Thread.sleep(TEST_PING_FREQUENCY * MAX_RETRIES * 8);
     
      ServerInvoker callbackServerInvoker = callbackConnector.getServerInvoker();
      field = BisocketServerInvoker.class.getDeclaredField("controlConnectionThreadMap");
      field.setAccessible(true);
      Map controlConnectionThreadMap = (Map) field.get(callbackServerInvoker);
      assertEquals(0, controlConnectionThreadMap.size());
     
View Full Code Here

            try
            {
               // Give the client a chance to connect to the server, then
               // disable the server.
               Thread.sleep(2000);
               ServerInvoker si = connector.getServerInvoker();
               assertTrue(si instanceof SocketServerInvoker);
               SocketServerInvoker ssi = (SocketServerInvoker) si;
               Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
               field.setAccessible(true);
               LRUPool clientpool = (LRUPool) field.get(ssi);
View Full Code Here

      client.invoke(CALLBACK_TEST);
      assertEquals(1, callbackHandler.counter);
      log.info("callback handler is installed");

      // Verify that "timeout" is used correctly.
      ServerInvoker serverInvoker = connector.getServerInvoker();
      Field field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
      Map callbackHandlers = (Map) field.get(serverInvoker);
      assertEquals(1, callbackHandlers.size());
      ServerInvokerCallbackHandler serverInvokerCallbackHandler;
View Full Code Here

     
      // Start server.
      setupServer();
     
      log.info("Updated locator: " + connector.getInvokerLocator());
      ServerInvoker invoker = connector.getServerInvoker();
      String name = invoker.getMBeanObjectName();
      ObjectName objectName = new ObjectName(name);
      log.info("objectName:" + objectName);
      printMBeans();
      assertTrue(mbeanServer.isRegistered(objectName));
      shutdownServer();
View Full Code Here

     
      Iterator it = callbackConnectors.iterator();
      while (it.hasNext())
      {
         Connector callbackConnector = (Connector) it.next();
         ServerInvoker serverInvoker = callbackConnector.getServerInvoker();
         Map clientCallbackListener = (Map) field.get(serverInvoker);
         assertEquals(1, clientCallbackListener.size());
         Object callbackContainer = clientCallbackListener.values().iterator().next();
         assertEquals(callbackHandler, method.invoke(callbackContainer, new Object[]{}));
      }
View Full Code Here

      Method method = callbackContainerClass.getDeclaredMethod("getCallbackHandler", new Class[] {});
      method.setAccessible(true);
      Field field = ServerInvoker.class.getDeclaredField("clientCallbackListener");
      field.setAccessible(true);

      ServerInvoker serverInvoker = callbackConnector.getServerInvoker();
      Map clientCallbackListener = (Map) field.get(serverInvoker);
      assertEquals(1, clientCallbackListener.size());
      Object callbackContainer = clientCallbackListener.values().iterator().next();
      assertEquals(callbackHandler, method.invoke(callbackContainer, new Object[]{}));
     
View Full Code Here

      Method method = callbackContainerClass.getDeclaredMethod("getCallbackHandler", new Class[] {});
      method.setAccessible(true);
      Field field = ServerInvoker.class.getDeclaredField("clientCallbackListener");
      field.setAccessible(true);

      ServerInvoker serverInvoker = callbackConnector.getServerInvoker();
      Map clientCallbackListener = (Map) field.get(serverInvoker);
      assertEquals(2, clientCallbackListener.size());
      Iterator it = clientCallbackListener.values().iterator();
      Object callbackContainer1 = it.next();
      Object callbackContainer2 = it.next();
View Full Code Here

   {
      log.info("entering " + getName());
      setupServer(registerCallbackListener);
     
      // Get fields.
      ServerInvoker serverInvoker = connector.getServerInvoker();
      Field field = ServerInvoker.class.getDeclaredField("connectionNotifier");
      field.setAccessible(true);
      ConnectionNotifier connectionNotifier = (ConnectionNotifier) field.get(serverInvoker);
      field = ServerInvoker.class.getDeclaredField("callbackHandlers");
      field.setAccessible(true);
View Full Code Here

TOP

Related Classes of org.jboss.remoting.ServerInvoker$CallbackContainer

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.