public abstract class AbstractChannel extends CloseableUtils.AbstractInnerCloseable implements Channel, ExecutorServiceConfigurer
| Modifier and Type | Class and Description |
|---|---|
class |
AbstractChannel.GracefulChannelCloseable |
protected static class |
AbstractChannel.GracefulState |
CloseableUtils.AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_CHANNEL_CLOSE_TIMEOUT |
static int |
DEFAULT_PACKET_SIZE |
static int |
DEFAULT_WINDOW_SIZE |
protected AtomicBoolean |
eof |
protected ExecutorService |
executor |
protected DefaultCloseFuture |
gracefulFuture |
protected AtomicReference<AbstractChannel.GracefulState> |
gracefulState |
protected List<RequestHandler<Channel>> |
handlers |
protected int |
id |
protected Window |
localWindow |
protected int |
recipient |
protected Window |
remoteWindow |
static Int2IntFunction |
RESPONSE_BUFFER_GROWTH_FACTOR
Default growth factor function used to resize response buffers
|
protected ConnectionService |
service |
protected Session |
session |
protected boolean |
shutdownExecutor |
closeFuture, lock, statelog| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChannel() |
protected |
AbstractChannel(String discriminator) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRequestHandler(RequestHandler<Channel> handler) |
protected void |
configureWindow() |
protected void |
doCloseImmediately()
doCloseImmediately is called once and only once
with state == Immediate
|
protected abstract void |
doWriteData(byte[] data,
int off,
int len) |
protected abstract void |
doWriteExtendedData(byte[] data,
int off,
int len) |
ExecutorService |
getExecutorService() |
int |
getId() |
protected Closeable |
getInnerCloseable() |
Window |
getLocalWindow() |
int |
getRecipient() |
Window |
getRemoteWindow() |
Session |
getSession() |
void |
handleClose() |
void |
handleData(Buffer buffer) |
void |
handleEof() |
void |
handleExtendedData(Buffer buffer) |
void |
handleFailure() |
void |
handleRequest(Buffer buffer) |
void |
handleWindowAdjust(Buffer buffer) |
void |
init(ConnectionService service,
Session session,
int id) |
boolean |
isEofSignalled() |
boolean |
isShutdownOnExit() |
protected void |
notifyStateChanged() |
protected void |
sendEof() |
protected void |
sendResponse(Buffer buffer,
String req,
RequestHandler.Result result,
boolean wantReply) |
protected void |
sendWindowAdjust(int len) |
void |
setEofSignalled(boolean on) |
void |
setExecutorService(ExecutorService service) |
void |
setShutdownOnExit(boolean shutdown) |
String |
toString() |
protected void |
writePacket(Buffer buffer) |
doCloseGracefullybuilder, close, isClosed, isClosing, preCloseclose, isOpenclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, handleOpenFailure, handleOpenSuccess, openpublic static final int DEFAULT_WINDOW_SIZE
public static final int DEFAULT_PACKET_SIZE
public static final long DEFAULT_CHANNEL_CLOSE_TIMEOUT
public static final Int2IntFunction RESPONSE_BUFFER_GROWTH_FACTOR
protected ExecutorService executor
protected boolean shutdownExecutor
protected final Window localWindow
protected final Window remoteWindow
protected ConnectionService service
protected Session session
protected int id
protected int recipient
protected final AtomicBoolean eof
protected AtomicReference<AbstractChannel.GracefulState> gracefulState
protected final DefaultCloseFuture gracefulFuture
protected final List<RequestHandler<Channel>> handlers
protected AbstractChannel()
protected AbstractChannel(String discriminator)
public void addRequestHandler(RequestHandler<Channel> handler)
public int getId()
public int getRecipient()
public Window getLocalWindow()
public Window getRemoteWindow()
public Session getSession()
public ExecutorService getExecutorService()
getExecutorService in interface ExecutorServiceCarrierpublic void setExecutorService(ExecutorService service)
setExecutorService in interface ExecutorServiceConfigurerpublic boolean isShutdownOnExit()
isShutdownOnExit in interface ExecutorServiceCarriertrue then the ExecutorService.shutdownNow()
will be called (unless it is an internally allocated service which is always
closed)public void setShutdownOnExit(boolean shutdown)
setShutdownOnExit in interface ExecutorServiceConfigurerpublic void handleRequest(Buffer buffer) throws IOException
IOExceptionprotected void sendResponse(Buffer buffer, String req, RequestHandler.Result result, boolean wantReply) throws IOException
IOExceptionpublic void init(ConnectionService service, Session session, int id)
protected void notifyStateChanged()
public void handleClose()
throws IOException
IOExceptionprotected Closeable getInnerCloseable()
getInnerCloseable in class CloseableUtils.AbstractInnerCloseableprotected void doCloseImmediately()
CloseableUtils.AbstractCloseabledoCloseImmediately is called once and only once with state == Immediate
Overriding methods should always call the base implementation. It may be called concurrently while preClose() or doCloseGracefully is executing
doCloseImmediately in class CloseableUtils.AbstractInnerCloseableprotected void writePacket(Buffer buffer) throws IOException
IOExceptionpublic void handleData(Buffer buffer) throws IOException
IOExceptionpublic void handleExtendedData(Buffer buffer) throws IOException
IOExceptionpublic boolean isEofSignalled()
public void setEofSignalled(boolean on)
public void handleEof()
throws IOException
IOExceptionpublic void handleWindowAdjust(Buffer buffer) throws IOException
IOExceptionpublic void handleFailure()
throws IOException
IOExceptionprotected abstract void doWriteData(byte[] data,
int off,
int len)
throws IOException
IOExceptionprotected abstract void doWriteExtendedData(byte[] data,
int off,
int len)
throws IOException
IOExceptionprotected void sendEof()
throws IOException
IOExceptionprotected void configureWindow()
protected void sendWindowAdjust(int len)
throws IOException
IOExceptionCopyright © 2008–2015 The Apache Software Foundation. All rights reserved.