public abstract class ProtocolContext extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
keepAlive |
protected int |
receiveBufferSize |
protected boolean |
reuseAddress |
protected int |
sendBufferSize |
protected boolean |
tcpNoDelay |
Constructor and Description |
---|
ProtocolContext() |
Modifier and Type | Method and Description |
---|---|
SocketHandler |
createConnection(Daemon daemon)
Create a socket handler for this protocol.
|
protected SocketHandler |
createConnectionImpl()
Creates a socket handler from the configured implementation class.
|
protected abstract ProtocolEngine |
createEngine()
Create a protocol engine.
|
abstract ExecutorService |
getExecutorService() |
int |
getReceiveBufferSize()
Get the socket receive buffer size.
|
int |
getSendBufferSize()
Get the socket send buffer size.
|
SocketConnectionFactory |
getSocketConnectionFactory() |
boolean |
getSocketOptionKeepAlive()
Indicates whether the SO_KEEPALIVE socket option is set on connected
sockets.
|
boolean |
getSocketOptionReuseAddress()
Indicates whether the SO_REUSEADDR socket option will be set on a server
socket.
|
boolean |
getSocketOptionTcpNoDelay()
Indicates whether the TCP_NODELAY socket option is set on connected sockets.
|
boolean |
getSoLinger() |
int |
getSoLingerTimeout() |
boolean |
hasSetSoLinger() |
void |
setReceiveBufferSize(int receiveBufferSize)
Set the receive buffer size for sockets.
|
void |
setSendBufferSize(int sendBufferSize)
Set the send buffer size for sockets.
|
void |
setSocketConnectionFactory(SocketConnectionFactory socketConnectionFactory) |
void |
setSocketHandlerImpl(Class<? extends SocketConnection> socketConnectionImpl)
Sets the socket handler implementation class for this context.
|
void |
setSocketOptionKeepAlive(boolean keepAlive)
Set the SO_KEEPALIVE socket option on connected sockets.
|
void |
setSocketOptionReuseAddress(boolean reuseAddress)
Indicates whether the SO_REUSEADDR socket option will be set on a server
socket.
|
void |
setSocketOptionTcpNoDelay(boolean tcpNoDelay)
Set the TCP_NODELAY socket option on connected sockets.
|
void |
setSoLinger(boolean on,
int timeout) |
abstract void |
shutdown() |
protected boolean keepAlive
protected boolean tcpNoDelay
protected boolean reuseAddress
protected int receiveBufferSize
protected int sendBufferSize
public SocketHandler createConnection(Daemon daemon) throws IOException
daemon
- DaemonIOException
protected abstract ProtocolEngine createEngine() throws IOException
IOException
public boolean getSocketOptionKeepAlive()
public boolean getSocketOptionReuseAddress()
public void setSocketOptionReuseAddress(boolean reuseAddress)
reuseAddress
- booleanpublic void setSocketHandlerImpl(Class<? extends SocketConnection> socketConnectionImpl) throws IOException
socketConnectionImpl
- ClassIOException
protected SocketHandler createConnectionImpl() throws IOException
IOException
public void setSocketOptionKeepAlive(boolean keepAlive)
keepAlive
- booleanpublic boolean getSocketOptionTcpNoDelay()
public void setSocketOptionTcpNoDelay(boolean tcpNoDelay)
tcpNoDelay
- booleanpublic void setReceiveBufferSize(int receiveBufferSize)
receiveBufferSize
- intpublic void setSendBufferSize(int sendBufferSize)
sendBufferSize
- intpublic int getReceiveBufferSize()
public int getSendBufferSize()
public SocketConnectionFactory getSocketConnectionFactory()
public void setSocketConnectionFactory(SocketConnectionFactory socketConnectionFactory)
public abstract void shutdown()
public int getSoLingerTimeout()
public boolean getSoLinger()
public void setSoLinger(boolean on, int timeout)
public boolean hasSetSoLinger()
public abstract ExecutorService getExecutorService()
Copyright © 2024. All rights reserved.