Class TTimeoutTransport


  • public class TTimeoutTransport
    extends Object
    A utility class for setting up a TTransport with various necessary configurations for ideal performance in Accumulo. These configurations include:
    • Setting SO_LINGER=false on the socket.
    • Setting TCP_NO_DELAY=true on the socket.
    • Setting timeouts on the I/OStreams.
    • Method Detail

      • create

        public static org.apache.thrift.transport.TTransport create​(HostAndPort addr,
                                                                    long timeoutMillis)
                                                             throws IOException
        Creates a Thrift TTransport to the given address with the given timeout. All created resources are closed if an exception is thrown.
        Parameters:
        addr - The address to connect the client to
        timeoutMillis - The timeout in milliseconds for the connection
        Returns:
        A TTransport connected to the given addr
        Throws:
        IOException - If the transport fails to be created/connected
      • create

        public static org.apache.thrift.transport.TTransport create​(SocketAddress addr,
                                                                    long timeoutMillis)
                                                             throws IOException
        Creates a Thrift TTransport to the given address with the given timeout. All created resources are closed if an exception is thrown.
        Parameters:
        addr - The address to connect the client to
        timeoutMillis - The timeout in milliseconds for the connection
        Returns:
        A TTransport connected to the given addr
        Throws:
        IOException - If the transport fails to be created/connected
      • createInternal

        protected org.apache.thrift.transport.TTransport createInternal​(SocketAddress addr,
                                                                        long timeoutMillis)
                                                                 throws IOException
        Opens a socket to the given addr, configures the socket, and then creates a Thrift transport using the socket.
        Parameters:
        addr - The address the socket should connect
        timeoutMillis - The socket timeout in milliseconds
        Returns:
        A TTransport instance to the given addr
        Throws:
        IOException - If the Thrift client is failed to be connected/created
      • openSocket

        protected Socket openSocket​(SocketAddress addr)
                             throws IOException
        Opens and configures a Socket for Accumulo RPC.
        Parameters:
        addr - The address to connect the socket to
        Returns:
        A socket connected to the given address, or null if the socket fails to connect
        Throws:
        IOException
      • openSocketChannel

        protected Socket openSocketChannel()
                                    throws IOException
        Opens a socket channel and returns the underlying socket.
        Throws:
        IOException