Class AsyncServerImpl

  • All Implemented Interfaces:
    AsyncServer

    public class AsyncServerImpl
    extends java.lang.Object
    implements AsyncServer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<java.lang.Void> closeServerChannel()
      Closes the server channel and then closes all existing channels that are open
      void disableOverloadMode()
      Start accepting connections again done after calling enableOverloadMode().
      void enableOverloadMode​(java.nio.ByteBuffer overloadResponse)
      Puts the server in a mode where all incoming connections are sent the response in the ByteBuffer provided and then the connection is closed immediately.
      org.webpieces.nio.api.channels.TCPServerChannel getUnderlyingChannel()  
      java.util.concurrent.CompletableFuture<java.lang.Void> start​(java.net.SocketAddress bindAddr)  
      • Methods inherited from class java.lang.Object

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

      • AsyncServerImpl

        public AsyncServerImpl​(org.webpieces.nio.api.channels.TCPServerChannel serverChannel2,
                               DefaultConnectionListener connectionListener,
                               ProxyDataListener proxyListener,
                               org.webpieces.nio.api.SSLEngineFactory sslFactory)
    • Method Detail

      • start

        public java.util.concurrent.CompletableFuture<java.lang.Void> start​(java.net.SocketAddress bindAddr)
        Specified by:
        start in interface AsyncServer
      • closeServerChannel

        public java.util.concurrent.CompletableFuture<java.lang.Void> closeServerChannel()
        Description copied from interface: AsyncServer
        Closes the server channel and then closes all existing channels that are open
        Specified by:
        closeServerChannel in interface AsyncServer
        Returns:
      • enableOverloadMode

        public void enableOverloadMode​(java.nio.ByteBuffer overloadResponse)
        Description copied from interface: AsyncServer
        Puts the server in a mode where all incoming connections are sent the response in the ByteBuffer provided and then the connection is closed immediately. This will not affect existing connections. This is so your system itself can stay stable under high load and perform gracefully for the requests that do get through in a reasonable time.
        Specified by:
        enableOverloadMode in interface AsyncServer
      • disableOverloadMode

        public void disableOverloadMode()
        Description copied from interface: AsyncServer
        Start accepting connections again done after calling enableOverloadMode(). OverloadMode is not enabled to start with.
        Specified by:
        disableOverloadMode in interface AsyncServer
      • getUnderlyingChannel

        public org.webpieces.nio.api.channels.TCPServerChannel getUnderlyingChannel()
        Specified by:
        getUnderlyingChannel in interface AsyncServer