public class TcpNioConnection extends TcpConnectionSupport
SocketChannel
.logger
Constructor and Description |
---|
TcpNioConnection(java.nio.channels.SocketChannel socketChannel,
boolean server,
boolean lookupHost)
Deprecated.
Use
TcpNioConnection(SocketChannel, boolean, boolean, ApplicationEventPublisher, String)
TODO: Remove in 3.1/4.0 |
TcpNioConnection(java.nio.channels.SocketChannel socketChannel,
boolean server,
boolean lookupHost,
org.springframework.context.ApplicationEventPublisher applicationEventPublisher,
java.lang.String connectionFactoryName)
Constructs a TcpNetConnection for the SocketChannel.
|
Modifier and Type | Method and Description |
---|---|
protected java.nio.ByteBuffer |
allocate(int length)
Allocates a ByteBuffer of the requested length using normal or
direct buffers, depending on the usingDirectBuffers field.
|
void |
close()
Closes this connection.
|
protected org.springframework.integration.ip.tcp.connection.TcpNioConnection.ChannelOutputStream |
getChannelOutputStream() |
java.lang.Object |
getDeserializerStateKey() |
long |
getLastRead() |
long |
getLastSend() |
java.lang.Object |
getPayload()
Uses the deserializer to obtain the message payload
from the connection's input stream.
|
int |
getPort() |
boolean |
isOpen() |
protected boolean |
isUsingDirectBuffers() |
void |
readPacket()
Invoked by the factory when there is data to be read.
|
void |
run()
If there is no listener, and this connection is not for single use,
this method exits.
|
void |
send(Message<?> message)
Converts and sends the message.
|
protected void |
sendToPipe(java.nio.ByteBuffer rawBuffer) |
void |
setLastRead(long lastRead) |
void |
setPipeTimeout(long pipeTimeout) |
void |
setTaskExecutor(java.util.concurrent.Executor taskExecutor) |
void |
setUsingDirectBuffers(boolean usingDirectBuffers)
If true, connection will attempt to use direct buffers where
possible.
|
afterSend, closeConnection, getConnectionId, getDeserializer, getHostAddress, getHostName, getListener, getMapper, getSender, getSerializer, incrementAndGetConnectionSequence, isNoReadErrorOnClose, isServer, isSingleUse, publishConnectionCloseEvent, publishConnectionExceptionEvent, publishConnectionOpenEvent, publishEvent, registerListener, registerSender, sendExceptionToListener, setDeserializer, setMapper, setNoReadErrorOnClose, setSerializer, setSingleUse
@Deprecated public TcpNioConnection(java.nio.channels.SocketChannel socketChannel, boolean server, boolean lookupHost) throws java.lang.Exception
TcpNioConnection(SocketChannel, boolean, boolean, ApplicationEventPublisher, String)
TODO: Remove in 3.1/4.0socketChannel
- the socketChannelserver
- if true this connection was created as
a result of an incoming request.java.lang.Exception
public TcpNioConnection(java.nio.channels.SocketChannel socketChannel, boolean server, boolean lookupHost, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, java.lang.String connectionFactoryName) throws java.lang.Exception
socketChannel
- the socketChannelserver
- if true this connection was created as
a result of an incoming request.java.lang.Exception
public void setPipeTimeout(long pipeTimeout)
public void close()
TcpConnectionSupport
close
in interface TcpConnection
close
in class TcpConnectionSupport
public boolean isOpen()
public void send(Message<?> message) throws java.lang.Exception
TcpConnection
message
- The messagejava.lang.Exception
public java.lang.Object getPayload() throws java.lang.Exception
TcpConnection
java.lang.Exception
public int getPort()
public java.lang.Object getDeserializerStateKey()
Deserializer
that
maintains state for this connection. Currently, this would be the InputStream
associated with the connection, but the object should be treated as opaque
and ONLY used as a key.protected java.nio.ByteBuffer allocate(int length)
public void run()
protected void sendToPipe(java.nio.ByteBuffer rawBuffer) throws java.io.IOException
java.io.IOException
public void readPacket()
public void setTaskExecutor(java.util.concurrent.Executor taskExecutor)
taskExecutor
- the taskExecutor to setpublic void setUsingDirectBuffers(boolean usingDirectBuffers)
usingDirectBuffers
- protected boolean isUsingDirectBuffers()
protected org.springframework.integration.ip.tcp.connection.TcpNioConnection.ChannelOutputStream getChannelOutputStream()
public long getLastRead()
public void setLastRead(long lastRead)
lastRead
- The time of the last read.public long getLastSend()