Class NioServerPerfTest


  • public class NioServerPerfTest
    extends java.lang.Object
    NIO based server for measuring heap-based vs direct byte buffers. Use NioClientTest as client test driver
    Since:
    3.6.4
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.nio.ByteBuffer buffer  
      static long BYTES_TO_SEND  
      protected java.nio.channels.ServerSocketChannel ch  
      protected boolean running  
      protected java.nio.channels.Selector selector  
      static int SIZE  
      protected java.util.concurrent.atomic.AtomicLong start  
      protected java.util.concurrent.atomic.AtomicLong total_bytes_received  
      protected java.util.concurrent.atomic.AtomicLong total_msgs  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.nio.ByteBuffer create​(int size, boolean direct)  
      protected boolean handle​(java.nio.channels.SocketChannel ch, java.nio.ByteBuffer buf)  
      static void main​(java.lang.String[] args)  
      protected void start​(boolean direct)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ch

        protected java.nio.channels.ServerSocketChannel ch
      • selector

        protected java.nio.channels.Selector selector
      • running

        protected volatile boolean running
      • buffer

        protected java.nio.ByteBuffer buffer
      • total_bytes_received

        protected final java.util.concurrent.atomic.AtomicLong total_bytes_received
      • total_msgs

        protected final java.util.concurrent.atomic.AtomicLong total_msgs
      • start

        protected final java.util.concurrent.atomic.AtomicLong start
    • Constructor Detail

      • NioServerPerfTest

        public NioServerPerfTest()
    • Method Detail

      • create

        protected static java.nio.ByteBuffer create​(int size,
                                                    boolean direct)
      • start

        protected void start​(boolean direct)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • handle

        protected boolean handle​(java.nio.channels.SocketChannel ch,
                                 java.nio.ByteBuffer buf)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception