Package com.rabbitmq.client.impl
Class SocketFrameHandler
- java.lang.Object
- 
- com.rabbitmq.client.impl.SocketFrameHandler
 
- 
- All Implemented Interfaces:
- FrameHandler,- NetworkConnection
 
 public class SocketFrameHandler extends Object implements FrameHandler A socket-based frame handler.
- 
- 
Field SummaryFields Modifier and Type Field Description static intSOCKET_CLOSING_TIMEOUTTime to linger before closing the socket forcefully.
 - 
Constructor SummaryConstructors Constructor Description SocketFrameHandler(Socket socket)SocketFrameHandler(Socket socket, ExecutorService shutdownExecutor)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the underlying data connection (complaint not permitted).voidflush()Flush the underlying data connection.InetAddressgetAddress()Retrieve address of peer.DataInputStreamgetInputStream()InetAddressgetLocalAddress()Retrieve the local host.intgetLocalPort()Retrieve the local port number.intgetPort()Retrieve port number of peer.intgetTimeout()Get the underlying socket's read timeout in milliseconds.voidinitialize(AMQConnection connection)FramereadFrame()Read aFramefrom the underlying data connection.voidsendHeader()Send the initial connection header, thus kickstarting the AMQP protocol version negotiation process and putting the underlying connection in a state such that the next layer of startup can proceed.voidsendHeader(int major, int minor)Write a 0-8-style connection header to the underlying socket, containing the specified version information, kickstarting the AMQP protocol version negotiation process.voidsendHeader(int major, int minor, int revision)Write a 0-9-1-style connection header to the underlying socket, containing the specified version information, kickstarting the AMQP protocol version negotiation process.voidsetTimeout(int timeoutMs)Set the underlying socket's read timeout in milliseconds, if applicable.voidwriteFrame(Frame frame)Write aFrameto the underlying data connection.
 
- 
- 
- 
Field Detail- 
SOCKET_CLOSING_TIMEOUTpublic static final int SOCKET_CLOSING_TIMEOUT Time to linger before closing the socket forcefully.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SocketFrameHandlerpublic SocketFrameHandler(Socket socket) throws IOException - Parameters:
- socket- the socket to use
- Throws:
- IOException
 
 - 
SocketFrameHandlerpublic SocketFrameHandler(Socket socket, ExecutorService shutdownExecutor) throws IOException - Parameters:
- socket- the socket to use
- Throws:
- IOException
 
 
- 
 - 
Method Detail- 
getAddresspublic InetAddress getAddress() Description copied from interface:NetworkConnectionRetrieve address of peer.- Specified by:
- getAddressin interface- NetworkConnection
 
 - 
getLocalAddresspublic InetAddress getLocalAddress() Description copied from interface:NetworkConnectionRetrieve the local host.- Specified by:
- getLocalAddressin interface- NetworkConnection
- Returns:
- the client socket address.
 
 - 
getInputStreampublic DataInputStream getInputStream() 
 - 
getPortpublic int getPort() Description copied from interface:NetworkConnectionRetrieve port number of peer.- Specified by:
- getPortin interface- NetworkConnection
 
 - 
getLocalPortpublic int getLocalPort() Description copied from interface:NetworkConnectionRetrieve the local port number.- Specified by:
- getLocalPortin interface- NetworkConnection
- Returns:
- the client socket port number
 
 - 
setTimeoutpublic void setTimeout(int timeoutMs) throws SocketExceptionDescription copied from interface:FrameHandlerSet the underlying socket's read timeout in milliseconds, if applicable.- Specified by:
- setTimeoutin interface- FrameHandler
- Parameters:
- timeoutMs- The timeout in milliseconds
- Throws:
- SocketException
 
 - 
getTimeoutpublic int getTimeout() throws SocketExceptionDescription copied from interface:FrameHandlerGet the underlying socket's read timeout in milliseconds.- Specified by:
- getTimeoutin interface- FrameHandler
- Returns:
- The timeout in milliseconds
- Throws:
- SocketException
 
 - 
sendHeaderpublic void sendHeader(int major, int minor) throws IOExceptionWrite a 0-8-style connection header to the underlying socket, containing the specified version information, kickstarting the AMQP protocol version negotiation process.- Parameters:
- major- major protocol version number
- minor- minor protocol version number
- Throws:
- IOException- if there is a problem accessing the connection
- See Also:
- sendHeader()
 
 - 
sendHeaderpublic void sendHeader(int major, int minor, int revision) throws IOExceptionWrite a 0-9-1-style connection header to the underlying socket, containing the specified version information, kickstarting the AMQP protocol version negotiation process.- Parameters:
- major- major protocol version number
- minor- minor protocol version number
- revision- protocol revision number
- Throws:
- IOException- if there is a problem accessing the connection
- See Also:
- sendHeader()
 
 - 
sendHeaderpublic void sendHeader() throws IOExceptionDescription copied from interface:FrameHandlerSend the initial connection header, thus kickstarting the AMQP protocol version negotiation process and putting the underlying connection in a state such that the next layer of startup can proceed.- Specified by:
- sendHeaderin interface- FrameHandler
- Throws:
- IOException- if there is a problem accessing the connection
 
 - 
initializepublic void initialize(AMQConnection connection) - Specified by:
- initializein interface- FrameHandler
 
 - 
readFramepublic Frame readFrame() throws IOException Description copied from interface:FrameHandlerRead aFramefrom the underlying data connection.- Specified by:
- readFramein interface- FrameHandler
- Returns:
- an incoming Frame, or null if there is none
- Throws:
- IOException- if there is a problem accessing the connection
- SocketTimeoutException- if the underlying read times out
 
 - 
writeFramepublic void writeFrame(Frame frame) throws IOException Description copied from interface:FrameHandlerWrite aFrameto the underlying data connection.- Specified by:
- writeFramein interface- FrameHandler
- Parameters:
- frame- the Frame to transmit
- Throws:
- IOException- if there is a problem accessing the connection
 
 - 
flushpublic void flush() throws IOExceptionDescription copied from interface:FrameHandlerFlush the underlying data connection.- Specified by:
- flushin interface- FrameHandler
- Throws:
- IOException- if there is a problem accessing the connection
 
 - 
closepublic void close() Description copied from interface:FrameHandlerClose the underlying data connection (complaint not permitted).- Specified by:
- closein interface- FrameHandler
 
 
- 
 
-