Package org.webpieces.asyncserver.impl
Class AsyncServerImpl
- java.lang.Object
-
- org.webpieces.asyncserver.impl.AsyncServerImpl
-
- All Implemented Interfaces:
AsyncServer
public class AsyncServerImpl extends java.lang.Object implements AsyncServer
-
-
Constructor Summary
Constructors Constructor Description AsyncServerImpl(org.webpieces.nio.api.channels.TCPServerChannel serverChannel2, DefaultConnectionListener connectionListener, ProxyDataListener proxyListener, org.webpieces.nio.api.SSLEngineFactory sslFactory)
-
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 openvoiddisableOverloadMode()Start accepting connections again done after calling enableOverloadMode().voidenableOverloadMode(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.TCPServerChannelgetUnderlyingChannel()java.util.concurrent.CompletableFuture<java.lang.Void>start(java.net.SocketAddress bindAddr)
-
-
-
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:
startin interfaceAsyncServer
-
closeServerChannel
public java.util.concurrent.CompletableFuture<java.lang.Void> closeServerChannel()
Description copied from interface:AsyncServerCloses the server channel and then closes all existing channels that are open- Specified by:
closeServerChannelin interfaceAsyncServer- Returns:
-
enableOverloadMode
public void enableOverloadMode(java.nio.ByteBuffer overloadResponse)
Description copied from interface:AsyncServerPuts 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:
enableOverloadModein interfaceAsyncServer
-
disableOverloadMode
public void disableOverloadMode()
Description copied from interface:AsyncServerStart accepting connections again done after calling enableOverloadMode(). OverloadMode is not enabled to start with.- Specified by:
disableOverloadModein interfaceAsyncServer
-
getUnderlyingChannel
public org.webpieces.nio.api.channels.TCPServerChannel getUnderlyingChannel()
- Specified by:
getUnderlyingChannelin interfaceAsyncServer
-
-