|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.ip.tcp.connection.TcpConnectionSupport
public abstract class TcpConnectionSupport
Base class for TcpConnections. TcpConnections are established by client connection factories (outgoing) or server connection factories (incoming).
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
TcpConnectionSupport()
|
|
TcpConnectionSupport(java.net.Socket socket,
boolean server,
boolean lookupHost,
org.springframework.context.ApplicationEventPublisher applicationEventPublisher,
java.lang.String connectionFactoryName)
Creates a TcpConnectionSupport object and publishes a TcpConnectionEvent
with TcpConnectionEvent.TcpConnectionEventType.OPEN , if so configured. |
Method Summary | |
---|---|
void |
afterSend(Message<?> message)
|
void |
close()
Closes this connection. |
protected void |
closeConnection()
If we have been intercepted, propagate the close from the outermost interceptor; otherwise, just call close(). |
java.lang.String |
getConnectionId()
|
org.springframework.core.serializer.Deserializer<?> |
getDeserializer()
|
java.lang.String |
getHostAddress()
|
java.lang.String |
getHostName()
|
TcpListener |
getListener()
|
TcpMessageMapper |
getMapper()
|
TcpSender |
getSender()
|
org.springframework.core.serializer.Serializer<?> |
getSerializer()
|
long |
incrementAndGetConnectionSequence()
|
boolean |
isServer()
|
boolean |
isSingleUse()
|
protected void |
publishConnectionCloseEvent()
|
protected void |
publishConnectionExceptionEvent(java.lang.Throwable t)
|
protected void |
publishConnectionOpenEvent()
|
void |
publishEvent(TcpConnectionEvent event)
Allow interceptors etc to publish events, perhaps subclasses of TcpConnectionEvent. |
void |
registerListener(TcpListener listener)
Sets the listener that will receive incoming Messages. |
void |
registerSender(TcpSender sender)
Registers a sender. |
void |
setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
|
void |
setMapper(TcpMessageMapper mapper)
|
void |
setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
|
void |
setSingleUse(boolean singleUse)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.integration.ip.tcp.connection.TcpConnection |
---|
getDeserializerStateKey, getPayload, getPort, isOpen, send |
Methods inherited from interface java.lang.Runnable |
---|
run |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public TcpConnectionSupport()
public TcpConnectionSupport(java.net.Socket socket, boolean server, boolean lookupHost, org.springframework.context.ApplicationEventPublisher applicationEventPublisher, java.lang.String connectionFactoryName)
TcpConnectionSupport
object and publishes a TcpConnectionEvent
with TcpConnectionEvent.TcpConnectionEventType.OPEN
, if so configured.
socket
- the underlying socket.server
- true if this connection is a server connectionlookupHost
- true if reverse lookup of the host name should be performed,
otherwise, the ip address will be used for identification purposes.applicationEventPublisher
- the publisher to which OPEN, CLOSE and EXCEPTION events will
be sent; may be null if event publishing is not required.connectionFactoryName
- the name of the connection factory creating this connection; used
during event publishing, may be null, in which case "unknown" will be used.Method Detail |
---|
public void afterSend(Message<?> message) throws java.lang.Exception
java.lang.Exception
public void close()
close
in interface TcpConnection
protected void closeConnection()
public TcpMessageMapper getMapper()
public void setMapper(TcpMessageMapper mapper)
mapper
- the mapper to setpublic org.springframework.core.serializer.Deserializer<?> getDeserializer()
getDeserializer
in interface TcpConnection
public void setDeserializer(org.springframework.core.serializer.Deserializer<?> deserializer)
deserializer
- the deserializer to setpublic org.springframework.core.serializer.Serializer<?> getSerializer()
getSerializer
in interface TcpConnection
public void setSerializer(org.springframework.core.serializer.Serializer<?> serializer)
serializer
- the serializer to setpublic void registerListener(TcpListener listener)
listener
- The listener.public void registerSender(TcpSender sender)
sender
- the sender.public TcpListener getListener()
getListener
in interface TcpConnection
public TcpSender getSender()
public void setSingleUse(boolean singleUse)
singleUse
- true if this socket is to used once and
discarded.public boolean isSingleUse()
isSingleUse
in interface TcpConnection
public boolean isServer()
isServer
in interface TcpConnection
public long incrementAndGetConnectionSequence()
incrementAndGetConnectionSequence
in interface TcpConnection
public java.lang.String getHostAddress()
getHostAddress
in interface TcpConnection
public java.lang.String getHostName()
getHostName
in interface TcpConnection
public java.lang.String getConnectionId()
getConnectionId
in interface TcpConnection
protected void publishConnectionOpenEvent()
protected void publishConnectionCloseEvent()
protected void publishConnectionExceptionEvent(java.lang.Throwable t)
public void publishEvent(TcpConnectionEvent event)
event
- the event to publish.
|
Spring Integration | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |