Package org.jboss.remoting.transport.socket

Examples of org.jboss.remoting.transport.socket.LRUPool


/*     */
/* 145 */       if (this.maxPoolSize <= 0)
/*     */       {
/* 147 */         this.maxPoolSize = MAX_POOL_SIZE_DEFAULT;
/*     */       }
/* 149 */       this.clientpool = new LRUPool(2, this.maxPoolSize);
/* 150 */       this.clientpool.create();
/* 151 */       this.threadpool = new LinkedList();
/* 152 */       checkSocketFactoryWrapper();
/*     */
/* 154 */       this.controlMonitorTimerTask = new ControlMonitorTimerTask(this);
View Full Code Here


      // 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);
      LRUPool clientpool = (LRUPool) field.get(connector.getServerInvoker());
      Set serverThreads = clientpool.getContents();
      assertEquals(1, serverThreads.size());
      ((ServerThread)serverThreads.iterator().next()).shutdown();
      HashMap metadata = new HashMap();
      metadata.put(COUNTER, new Integer(0));
      client.invoke(INVOCATION_TEST, metadata);
View Full Code Here

      // 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();
      HashMap metadata = new HashMap();
      metadata.put(COUNTER, new Integer(0));
      client.invoke(INVOCATION_TEST, metadata);
View Full Code Here

     
      Connector oldConnector = connector;
      SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(invoker);
      Set threads = clientpool.getContents();
      for (Iterator it = threads.iterator(); it.hasNext(); )
      {
         ServerThread t = (ServerThread) it.next();
         field = ServerThread.class.getDeclaredField("socketWrapper");
         field.setAccessible(true);
View Full Code Here

     
      Connector oldConnector = connector;
      SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(invoker);
      Set threads = clientpool.getContents();
      for (Iterator it = threads.iterator(); it.hasNext(); )
      {
         ServerThread t = (ServerThread) it.next();
         field = ServerThread.class.getDeclaredField("socketWrapper");
         field.setAccessible(true);
View Full Code Here

      assertEquals(1, callbackHandler.callbackCounter);
     
      SocketServerInvoker invoker = (SocketServerInvoker) connector.getServerInvoker();
      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(invoker);
      Set threads = clientpool.getContents();
      for (Iterator it = threads.iterator(); it.hasNext(); )
      {
         ServerThread t = (ServerThread) it.next();
         field = ServerThread.class.getDeclaredField("socketWrapper");
         field.setAccessible(true);
View Full Code Here

      // 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);
      LRUPool clientpool = (LRUPool) field.get(serverInvoker);
      Set serverThreads = clientpool.getContents();
      assertEquals(1, serverThreads.size());
      ((ServerThread)serverThreads.iterator().next()).shutdown();
      HashMap metadata = new HashMap();
      metadata.put(COUNTER, new Integer(0));
      client.invoke(INVOCATION_TEST, metadata);
View Full Code Here

      Field field = SocketServerInvoker.class.getDeclaredField("threadpool");
      field.setAccessible(true);
      List threadpool = (List) field.get(connector.getServerInvoker());
      field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(connector.getServerInvoker());
     
      // Create client.
      InvokerLocator clientLocator = new InvokerLocator(locatorURI);
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      addExtraClientConfig(clientConfig);
      Client client = new Client(clientLocator, clientConfig);
      client.connect();
      log.info("client is connected");
     
      Thread.sleep(2000);
     
      // Create 5 connections.
      for (int i = 0; i < 5; i++)
      {
         client.invokeOneway("4", null, true);
      }

      Thread.sleep(2000); // time = 4000
      assertEquals(0, threadpool.size());
      assertEquals(5, clientpool.size());
     
      // ServerThreads should be back in threadpool at 6000.
      client.disconnect();
      Thread.sleep(4000); // time = 8000
      assertEquals(5, threadpool.size());
      assertEquals(0, clientpool.size());
     
      // Wait until IdleTimerTask runs at 10000.
      Thread.sleep(4000)// time = 12000
     
      for (int i = 0; i < 5; i++)
View Full Code Here

      // Verify that "timeout" is used correctly.
      assertTrue(connector.getServerInvoker() instanceof SocketServerInvoker);
      SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(serverInvoker);
      Set threads = clientpool.getContents();
      assertEquals(1, threads.size());
      ServerThread serverThread = (ServerThread) threads.iterator().next();
      field = ServerThread.class.getDeclaredField("socketWrapper");
      field.setAccessible(true);
      assertTrue(field.get(serverThread) instanceof ServerSocketWrapper);
View Full Code Here

      // Verify that "timeout" is used correctly.
      assertTrue(connector.getServerInvoker() instanceof SocketServerInvoker);
      SocketServerInvoker serverInvoker = (SocketServerInvoker) connector.getServerInvoker();
      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(serverInvoker);
      Set threads = clientpool.getContents();
      assertEquals(1, threads.size());
      ServerThread serverThread = (ServerThread) threads.iterator().next();
      field = ServerThread.class.getDeclaredField("socketWrapper");
      field.setAccessible(true);
      assertTrue(field.get(serverThread) instanceof ServerSocketWrapper);
View Full Code Here

TOP

Related Classes of org.jboss.remoting.transport.socket.LRUPool

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.