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, toString
public InboundWay(Connection<?> connection, int bufferSize)
connection
- The parent connection.bufferSize
- The byte buffer size.public void clear()
Way
protected Representation createEntity(Series<Header> headers)
headers
- The headers to use.protected boolean fillLine() throws IOException
IOException
protected int getBuilderIndex()
protected SelectionRegistration getEntityRegistration()
public int getInterestOperations()
Way
getInterestOperations
in class Way
protected boolean isLineReadable() throws IOException
IOException
public void onMessageCompleted(boolean endDetected) throws IOException
Way
onMessageCompleted
in interface CompletionListener
onMessageCompleted
in class Way
endDetected
- Indicates if the end of the socket channel was detected.IOException
public int onDrain(Buffer buffer, int maxDrained, Object... args) throws IOException
Way
onDrain
in interface BufferProcessor
onDrain
in class Way
buffer
- 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.IOException
public int onFill(Buffer buffer, Object... args) throws IOException
Way
onFill
in interface BufferProcessor
onFill
in class Way
buffer
- The IO buffer to drain.args
- The optional arguments to pass back to the callbacks.IOException
public void onFillEof()
protected void onPostProcessing()
Way
IoState.INTEREST
.onPostProcessing
in class Way
protected void onHeadersCompleted() throws IOException
onHeadersCompleted
in class Way
IOException
protected abstract void onReceived(Response message) throws IOException
message
- The new message received.IOException
public void onTimeOut()
Way
public int processIoBuffer() throws IOException
Way
processIoBuffer
in class Way
IOException
protected Header readHeader() throws IOException
IOException
protected abstract void readStartLine() throws IOException
IOException
protected 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()
Way
updateState
in class Way
Copyright © 2005–2015. All rights reserved.