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 void
close()
Close the underlying data connection (complaint not permitted).void
flush()
Flush the underlying data connection.InetAddress
getAddress()
Retrieve address of peer.InetAddress
getLocalAddress()
Retrieve the local host.int
getLocalPort()
Retrieve the local port number.int
getPort()
Retrieve port number of peer.SocketChannelFrameHandlerState
getState()
int
getTimeout()
Get the underlying socket's read timeout in milliseconds.void
initialize(AMQConnection connection)
Frame
readFrame()
Read aFrame
from the underlying data connection.void
sendHeader()
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.void
setTimeout(int timeoutMs)
Set the underlying socket's read timeout in milliseconds, if applicable.void
writeFrame(Frame frame)
Write aFrame
to the underlying data connection.
-
-
-
Constructor Detail
-
SocketChannelFrameHandler
public SocketChannelFrameHandler(SocketChannelFrameHandlerState state)
-
-
Method Detail
-
getLocalAddress
public InetAddress getLocalAddress()
Description copied from interface:NetworkConnection
Retrieve the local host.- Specified by:
getLocalAddress
in interfaceNetworkConnection
- Returns:
- the client socket address.
-
getLocalPort
public int getLocalPort()
Description copied from interface:NetworkConnection
Retrieve the local port number.- Specified by:
getLocalPort
in interfaceNetworkConnection
- Returns:
- the client socket port number
-
getAddress
public InetAddress getAddress()
Description copied from interface:NetworkConnection
Retrieve address of peer.- Specified by:
getAddress
in interfaceNetworkConnection
-
getPort
public int getPort()
Description copied from interface:NetworkConnection
Retrieve port number of peer.- Specified by:
getPort
in interfaceNetworkConnection
-
setTimeout
public void setTimeout(int timeoutMs) throws SocketException
Description copied from interface:FrameHandler
Set the underlying socket's read timeout in milliseconds, if applicable.- Specified by:
setTimeout
in interfaceFrameHandler
- Parameters:
timeoutMs
- The timeout in milliseconds- Throws:
SocketException
-
getTimeout
public int getTimeout() throws SocketException
Description copied from interface:FrameHandler
Get the underlying socket's read timeout in milliseconds.- Specified by:
getTimeout
in interfaceFrameHandler
- Returns:
- The timeout in milliseconds
- Throws:
SocketException
-
sendHeader
public void sendHeader() throws IOException
Description copied from interface:FrameHandler
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.- Specified by:
sendHeader
in interfaceFrameHandler
- Throws:
IOException
- if there is a problem accessing the connection
-
initialize
public void initialize(AMQConnection connection)
- Specified by:
initialize
in interfaceFrameHandler
-
readFrame
public Frame readFrame() throws IOException
Description copied from interface:FrameHandler
Read aFrame
from the underlying data connection.- Specified by:
readFrame
in 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:FrameHandler
Write aFrame
to the underlying data connection.- Specified by:
writeFrame
in interfaceFrameHandler
- Parameters:
frame
- the Frame to transmit- Throws:
IOException
- if there is a problem accessing the connection
-
flush
public void flush() throws IOException
Description copied from interface:FrameHandler
Flush the underlying data connection.- Specified by:
flush
in interfaceFrameHandler
- Throws:
IOException
- if there is a problem accessing the connection
-
close
public void close()
Description copied from interface:FrameHandler
Close the underlying data connection (complaint not permitted).- Specified by:
close
in interfaceFrameHandler
-
getState
public SocketChannelFrameHandlerState getState()
-
-