Package org.jboss.remoting.transport.socket

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


      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);
      ServerSocketWrapper serverWrapper = (ServerSocketWrapper) field.get(serverThread);
      assertEquals(3000, serverWrapper.getTimeout());
View Full Code Here


      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);
      ServerSocketWrapper serverWrapper = (ServerSocketWrapper) field.get(serverThread);
      assertEquals(3000, serverWrapper.getTimeout());
View Full Code Here

      protected void processInvocation(Socket socket) throws Exception
      {
         clientpool = new LRUPool(2, maxPoolSize);
         clientpool.create();
         threadpool = new LinkedList();
         ServerThread worker = new TestServerThread(socket, this, clientpool, threadpool, 0, 0, ServerSocketWrapper.class.getName());
         worker.start();
      }
View Full Code Here

               if(clientpool.size() < maxPoolSize)
               {
                  Thread thread = null;
                  try
                  {
                     thread = new ServerThread(socket, BisocketServerInvoker.this,
                                               clientpool, threadpool,
                                               getTimeout(), serverSocketClass);
                     thread.start();

                     if (log.isDebugEnabled())
View Full Code Here

      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(invoker);
      assertEquals(1, clientpool.size());
      Set s =  clientpool.getContents();
      ServerThread serverThread1 = (ServerThread) s.iterator().next();
     
      // Get threadpool.
      field = SocketServerInvoker.class.getDeclaredField("threadpool");
      field.setAccessible(true);
      LinkedList threadpool = (LinkedList) field.get(invoker);
      assertEquals(0, threadpool.size());
     
      // Wait for ServerThread to time out.
      Thread.sleep(6000);
      for (int i = 0; i < 5; i++)
      {
         Thread.sleep(2000);
         if (clientpool.size() == 0) break;
      }
     
      if (clientpool.size() > 0)
      {
         fail("expect clientpool.size() == 0");
      }
     
      // Verify original ServerThread was returned to threadpool.
      assertEquals(1, threadpool.size());
      assertEquals(serverThread1, threadpool.iterator().next());
     
      // Make another invocation and verify ServerThread was reused.
      client.invoke("xyz");
      assertEquals(1, clientpool.size());
      s =  clientpool.getContents();
      ServerThread serverThread2 = (ServerThread) s.iterator().next();
      assertEquals(serverThread1, serverThread2);
     
      client.disconnect();
      shutdownServer();
      log.info(getName() + " PASSES");
View Full Code Here

      Field field = SocketServerInvoker.class.getDeclaredField("clientpool");
      field.setAccessible(true);
      LRUPool clientpool = (LRUPool) field.get(invoker);
      assertEquals(1, clientpool.size());
      Set clientpoolContents =  clientpool.getContents();
      ServerThread serverThread1 = (ServerThread) clientpoolContents.iterator().next();
     
      // Get threadpool.
      field = SocketServerInvoker.class.getDeclaredField("threadpool");
      field.setAccessible(true);
      LinkedList threadpool = (LinkedList) field.get(invoker);
      assertEquals(0, threadpool.size());
     
      // Wait for ServerThread to time out.
      Thread.sleep(8000);
     
      // Verify original ServerThread remains in clientpool.
      assertEquals(0, threadpool.size());
      assertEquals(1, clientpool.size());
      clientpoolContents =  clientpool.getContents();
      assertEquals(serverThread1, clientpoolContents.iterator().next());
     
      // Make another invocation and verify ServerThread was reused.
      client.invoke("xyz");
      assertEquals(1, clientpool.size());
      clientpoolContents =  clientpool.getContents();
      ServerThread serverThread2 = (ServerThread) clientpoolContents.iterator().next();
      assertEquals(serverThread1, serverThread2);
     
      client.disconnect();
      shutdownServer();
      log.info(getName() + " PASSES");
View Full Code Here

               if(clientpool.size() < maxPoolSize)
               {
                  Thread thread = null;
                  try
                  {
                     thread = new ServerThread(socket, BisocketServerInvoker.this,
                                               clientpool, threadpool,
                                               getTimeout(), serverSocketClass);
                     thread.start();

                     if (log.isDebugEnabled())
View Full Code Here

      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);
         SocketWrapper socketWrapper = (SocketWrapper) field.get(t);
         socketWrapper.close();
      }
View Full Code Here

               if(clientpool.size() < maxPoolSize)
               {
                  Thread thread = null;
                  try
                  {
                     thread = new ServerThread(socket, BisocketServerInvoker.this,
                                               clientpool, threadpool,
                                               getTimeout(), serverSocketClass);
                     thread.start();

                     if (log.isDebugEnabled())
View Full Code Here

               if(clientpool.size() < maxPoolSize)
               {
                  Thread thread = null;
                  try
                  {
                     thread = new ServerThread(socket, BisocketServerInvoker.this,
                                               clientpool, threadpool,
                                               getTimeout(), serverSocketClass);
                     thread.start();

                     if (log.isDebugEnabled())
View Full Code Here

TOP

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

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.