Package com.rabbitmq.client.impl.nio
Class SocketChannelFrameHandler
- java.lang.Object
-
- com.rabbitmq.client.impl.nio.SocketChannelFrameHandler
-
- All Implemented Interfaces:
FrameHandler,NetworkConnection
public class SocketChannelFrameHandler extends Object implements FrameHandler
-
-
Constructor Summary
Constructors Constructor Description SocketChannelFrameHandler(SocketChannelFrameHandlerState state)
-
Method Summary
All 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.InetAddressgetLocalAddress()Retrieve the local host.intgetLocalPort()Retrieve the local port number.intgetPort()Retrieve port number of peer.SocketChannelFrameHandlerStategetState()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.voidsetTimeout(int timeoutMs)Set the underlying socket's read timeout in milliseconds, if applicable.voidwriteFrame(Frame frame)Write aFrameto the underlying data connection.
-
-
-
Constructor Detail
-
SocketChannelFrameHandler
public SocketChannelFrameHandler(SocketChannelFrameHandlerState state)
-
-
Method Detail
-
getLocalAddress
public InetAddress getLocalAddress()
Description copied from interface:NetworkConnectionRetrieve the local host.- Specified by:
getLocalAddressin interfaceNetworkConnection- Returns:
- the client socket address.
-
getLocalPort
public int getLocalPort()
Description copied from interface:NetworkConnectionRetrieve the local port number.- Specified by:
getLocalPortin interfaceNetworkConnection- Returns:
- the client socket port number
-
getAddress
public InetAddress getAddress()
Description copied from interface:NetworkConnectionRetrieve address of peer.- Specified by:
getAddressin interfaceNetworkConnection
-
getPort
public int getPort()
Description copied from interface:NetworkConnectionRetrieve port number of peer.- Specified by:
getPortin interfaceNetworkConnection
-
setTimeout
public void setTimeout(int timeoutMs) throws SocketExceptionDescription 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
public int getTimeout() throws SocketExceptionDescription copied from interface:FrameHandlerGet the underlying socket's read timeout in milliseconds.- Specified by:
getTimeoutin interfaceFrameHandler- Returns:
- The timeout in milliseconds
- Throws:
SocketException
-
sendHeader
public 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 interfaceFrameHandler- Throws:
IOException- if there is a problem accessing the connection
-
initialize
public void initialize(AMQConnection connection)
- Specified by:
initializein interfaceFrameHandler
-
readFrame
public Frame readFrame() throws IOException
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 connectionSocketTimeoutException- if the underlying read times out
-
writeFrame
public void writeFrame(Frame frame) throws IOException
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
public void flush() throws IOExceptionDescription 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
-
getState
public SocketChannelFrameHandlerState getState()
-
-