public abstract class InboundWay extends Way
| Constructor and Description |
|---|
InboundWay(Connection<?> connection,
int bufferSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Recycles the way so it can be reused.
|
protected Representation |
createEntity(Series<Header> headers)
Returns the message entity if available.
|
protected boolean |
fillLine()
Read the current message line (start line or header line).
|
protected int |
getBuilderIndex()
Returns the line builder index.
|
protected SelectionRegistration |
getEntityRegistration()
Returns the NIO selection registration of the entity.
|
int |
getInterestOperations()
Returns the operations of interest.
|
protected boolean |
isLineReadable()
Indicates if the next message line is readable.
|
int |
onDrain(Buffer buffer,
int maxDrained,
Object... args)
Drains the byte buffer by writing available bytes to the socket channel.
|
void |
onError(Status status)
Called on error.
|
int |
onFill(Buffer buffer,
Object... args)
Fills the byte buffer by writing the current message.
|
void |
onFillEof()
Called back when a fill operation returns with an EOF status.
|
protected void |
onHeadersCompleted()
Callback invoked when a message has been received.
|
void |
onMessageCompleted(boolean endDetected)
Callback method invoked when the current message has been completely
received or sent.
|
protected void |
onPostProcessing()
Called back after the IO processing to indicate if there is further IO
interest.
|
protected abstract void |
onReceived(Response message)
Call back invoked when the message is received.
|
void |
onTimeOut()
Called back by the controller when an IO time out has been detected.
|
int |
processIoBuffer()
Processes the IO buffer by filling and draining it.
|
protected Header |
readHeader()
Read a message header.
|
protected abstract void |
readStartLine()
Read the start line of the current message received.
|
protected void |
setBuilderIndex(int builderIndex)
Sets the line builder index.
|
protected void |
setEntityRegistration(SelectionRegistration entityRegistration)
Sets the NIO selection registration of the entity.
|
void |
updateState()
Updates the way IO and message states.
|
canLoop, clearLineBuilder, couldDrain, couldFill, getActualMessage, getBuffer, getConnection, getHeaders, getHelper, getIoState, getLineBuilder, getLineBuilderState, getLoadScore, getLogger, getMessage, getMessageState, getRegistration, hasIoInterest, isAvailable, isEmpty, onClosed, onSelected, postProcess, preProcess, setHeaders, setIoState, setLineBuilderState, setMessage, setMessageState, setRegistration, toStringpublic InboundWay(Connection<?> connection, int bufferSize)
connection - The parent connection.bufferSize - The byte buffer size.public void clear()
Wayprotected Representation createEntity(Series<Header> headers)
headers - The headers to use.protected boolean fillLine()
throws IOException
IOExceptionprotected int getBuilderIndex()
protected SelectionRegistration getEntityRegistration()
public int getInterestOperations()
WaygetInterestOperations in class Wayprotected boolean isLineReadable()
throws IOException
IOExceptionpublic int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
WayonDrain in interface BufferProcessoronDrain in class Waybuffer - The IO buffer to drain.maxDrained - The maximum number of bytes drained by this call.args - The optional arguments to pass back to the callbacks.IOExceptionpublic int onFill(Buffer buffer, Object... args) throws IOException
WayonFill in interface BufferProcessoronFill in class Waybuffer - The IO buffer to drain.args - The optional arguments to pass back to the callbacks.IOExceptionpublic void onFillEof()
protected void onHeadersCompleted()
throws IOException
onHeadersCompleted in class WayIOExceptionpublic void onMessageCompleted(boolean endDetected)
throws IOException
WayonMessageCompleted in interface CompletionListeneronMessageCompleted in class WayendDetected - Indicates if the end of the socket channel was detected.IOExceptionprotected void onPostProcessing()
WayIoState.INTEREST.onPostProcessing in class Wayprotected abstract void onReceived(Response message) throws IOException
message - The new message received.IOExceptionpublic void onTimeOut()
Waypublic int processIoBuffer()
throws IOException
WayprocessIoBuffer in class WayIOExceptionprotected Header readHeader() throws IOException
IOExceptionprotected abstract void readStartLine()
throws IOException
IOExceptionprotected void setBuilderIndex(int builderIndex)
builderIndex - The line builder index.protected void setEntityRegistration(SelectionRegistration entityRegistration)
entityRegistration - The NIO selection registration of the entity.public void updateState()
WayupdateState in class WayCopyright © 2005–2015. All rights reserved.