Package net.officefloor.server
Interface RequestHandler<R>
-
public interface RequestHandler<R>
Handles requests.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RequestHandler.Execution
Function
interface to run an execution on theSocket
Thread
.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeConnection(java.lang.Throwable exception)
Allows to close connection.void
execute(RequestHandler.Execution execution)
void
handleRequest(R request)
Handles a request.void
sendImmediateData(StreamBuffer<java.nio.ByteBuffer> immediateHead)
Sends data immediately.
-
-
-
Method Detail
-
execute
void execute(RequestHandler.Execution execution)
- Parameters:
execution
-RequestHandler.Execution
.
-
handleRequest
void handleRequest(R request) throws java.lang.IllegalStateException
Handles a request.
This may only be invoked by the
Socket
Thread
.- Parameters:
request
- Request.- Throws:
java.lang.IllegalStateException
- If invoked from anotherThread
.
-
sendImmediateData
void sendImmediateData(StreamBuffer<java.nio.ByteBuffer> immediateHead) throws java.lang.IllegalStateException
Sends data immediately.
This may only be invoked by the
Socket
Thread
.- Parameters:
immediateHead
- HeadStreamBuffer
to linked list ofStreamBuffer
instances of data to send immediately.- Throws:
java.lang.IllegalStateException
- If invoked from anotherThread
.
-
closeConnection
void closeConnection(java.lang.Throwable exception)
Allows to close connection.- Parameters:
exception
- OptionalException
for the cause of closing the connection.null
to indicate normal close.
-
-