Package com.rabbitmq.client.impl
Class SocketFrameHandler
java.lang.Object
com.rabbitmq.client.impl.SocketFrameHandler
- All Implemented Interfaces:
FrameHandler,NetworkConnection
A socket-based frame handler.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intTime to linger before closing the socket forcefully. -
Constructor Summary
ConstructorsConstructorDescriptionSocketFrameHandler(Socket socket) SocketFrameHandler(Socket socket, ExecutorService shutdownExecutor, int maxInboundMessageBodySize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the underlying data connection (complaint not permitted).voidflush()Flush the underlying data connection.Retrieve address of peer.Retrieve the local host.intRetrieve the local port number.intgetPort()Retrieve port number of peer.intGet the underlying socket's read timeout in milliseconds.voidinitialize(AMQConnection connection) Read aFramefrom the underlying data connection.voidSend 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 Details
-
SOCKET_CLOSING_TIMEOUT
public static final int SOCKET_CLOSING_TIMEOUTTime to linger before closing the socket forcefully.- See Also:
-
-
Constructor Details
-
SocketFrameHandler
- Parameters:
socket- the socket to use- Throws:
IOException
-
SocketFrameHandler
public SocketFrameHandler(Socket socket, ExecutorService shutdownExecutor, int maxInboundMessageBodySize) throws IOException - Parameters:
socket- the socket to use- Throws:
IOException
-
-
Method Details
-
getAddress
Description copied from interface:NetworkConnectionRetrieve address of peer.- Specified by:
getAddressin interfaceNetworkConnection
-
getLocalAddress
Description copied from interface:NetworkConnectionRetrieve the local host.- Specified by:
getLocalAddressin interfaceNetworkConnection- Returns:
- the client socket address.
-
getInputStream
-
getPort
public int getPort()Description copied from interface:NetworkConnectionRetrieve port number of peer.- Specified by:
getPortin interfaceNetworkConnection
-
getLocalPort
public int getLocalPort()Description copied from interface:NetworkConnectionRetrieve the local port number.- Specified by:
getLocalPortin interfaceNetworkConnection- Returns:
- the client socket port number
-
setTimeout
Description copied from interface:FrameHandlerSet the underlying socket's read timeout in milliseconds, if applicable.- Specified by:
setTimeoutin interfaceFrameHandler- Parameters:
timeoutMs- The timeout in milliseconds- Throws:
SocketException
-
getTimeout
Description copied from interface:FrameHandlerGet the underlying socket's read timeout in milliseconds.- Specified by:
getTimeoutin interfaceFrameHandler- Returns:
- The timeout in milliseconds
- Throws:
SocketException
-
sendHeader
Write 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 numberminor- minor protocol version number- Throws:
IOException- if there is a problem accessing the connection- See Also:
-
sendHeader
Write 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 numberminor- minor protocol version numberrevision- protocol revision number- Throws:
IOException- if there is a problem accessing the connection- See Also:
-
sendHeader
Description 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 interfaceFrameHandler- Throws:
IOException- if there is a problem accessing the connection
-
initialize
- Specified by:
initializein interfaceFrameHandler
-
readFrame
Description copied from interface:FrameHandlerRead aFramefrom the underlying data connection.- Specified by:
readFramein interfaceFrameHandler- Returns:
- an incoming Frame, or null if there is none
- Throws:
IOException- if there is a problem accessing the connection
-
writeFrame
Description copied from interface:FrameHandlerWrite aFrameto the underlying data connection.- Specified by:
writeFramein interfaceFrameHandler- Parameters:
frame- the Frame to transmit- Throws:
IOException- if there is a problem accessing the connection
-
flush
Description copied from interface:FrameHandlerFlush the underlying data connection.- Specified by:
flushin interfaceFrameHandler- Throws:
IOException- if there is a problem accessing the connection
-
close
public void close()Description copied from interface:FrameHandlerClose the underlying data connection (complaint not permitted).- Specified by:
closein interfaceFrameHandler
-