Class Connection

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    NioConnection, TcpConnection

    public abstract class Connection
    extends java.lang.Object
    implements java.io.Closeable
    Represents a connection to a peer
    • Field Detail

      • cookie

        public static final byte[] cookie
      • peer_addr

        protected Address peer_addr
      • last_access

        protected long last_access
    • Constructor Detail

      • Connection

        public Connection()
    • Method Detail

      • isConnected

        public abstract boolean isConnected()
      • isConnectionPending

        public abstract boolean isConnectionPending()
      • isClosed

        public abstract boolean isClosed()
      • localAddress

        public abstract Address localAddress()
      • peerAddress

        public Address peerAddress()
      • flush

        public abstract void flush()
      • connect

        public abstract void connect​(Address dest)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • start

        public abstract void start()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • send

        public abstract void send​(byte[] buf,
                                  int offset,
                                  int length)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • send

        public abstract void send​(java.nio.ByteBuffer buf)
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • status

        public abstract java.lang.String status()
      • getTimestamp

        protected long getTimestamp()
      • updateLastAccessed

        protected void updateLastAccessed()
      • isExpired

        public boolean isExpired​(long now)