Package org.webpieces.asyncserver.api
Interface AsyncServer
-
- All Known Implementing Classes:
AsyncServerImpl
public interface AsyncServer
-
-
Method Summary
All Methods Instance Methods Abstract 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)
-
-
-
Method Detail
-
start
java.util.concurrent.CompletableFuture<java.lang.Void> start(java.net.SocketAddress bindAddr)
-
closeServerChannel
java.util.concurrent.CompletableFuture<java.lang.Void> closeServerChannel()
Closes the server channel and then closes all existing channels that are open- Returns:
-
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. 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.- Parameters:
overloadResponse-
-
disableOverloadMode
void disableOverloadMode()
Start accepting connections again done after calling enableOverloadMode(). OverloadMode is not enabled to start with.
-
getUnderlyingChannel
org.webpieces.nio.api.channels.TCPServerChannel getUnderlyingChannel()
-
-