Class AprSession

    • Field Detail

      • descriptor

        private long descriptor
      • remoteAddress

        private final java.net.InetSocketAddress remoteAddress
      • localAddress

        private final java.net.InetSocketAddress localAddress
      • readable

        private boolean readable
      • writable

        private boolean writable
      • interestedInRead

        private boolean interestedInRead
      • interestedInWrite

        private boolean interestedInWrite
    • Constructor Detail

      • AprSession

        AprSession​(IoService service,
                   IoProcessor<AprSession> processor,
                   long descriptor)
            throws java.lang.Exception
        Creates a new instance of AprSession. Need to be called by extending types
        Parameters:
        service - the IoService creating this session. Can be AprSocketAcceptor or AprSocketConnector
        processor - the AprIoProcessor managing this session.
        descriptor - the low level APR socket descriptor for this socket. @see Socket#create(int, int, int, long)
        Throws:
        java.lang.Exception - exception produced during the setting of all the socket parameters.
      • AprSession

        AprSession​(IoService service,
                   IoProcessor<AprSession> processor,
                   long descriptor,
                   java.net.InetSocketAddress remoteAddress)
            throws java.lang.Exception
        Creates a new instance of AprSession. Need to be called by extending types. The constructor add remote address for UDP based sessions.
        Parameters:
        service - the IoService creating this session. Can be AprSocketAcceptor or AprSocketConnector
        processor - the AprIoProcessor managing this session.
        descriptor - the low level APR socket descriptor for this socket. @see Socket#create(int, int, int, long)
        remoteAddress - the remote end-point
        Throws:
        java.lang.Exception - exception produced during the setting of all the socket parameters.
    • Method Detail

      • getDescriptor

        long getDescriptor()
        Get the socket descriptor @see Socket#create(int, int, int, long).
        Returns:
        the low level APR socket descriptor
      • setDescriptor

        void setDescriptor​(long desc)
        Set the socket descriptor.
        Parameters:
        desc - the low level APR socket descriptor created by @see Socket#create(int, int, int, long)
      • getLocalAddress

        public java.net.InetSocketAddress getLocalAddress()
        Returns:
        the socket address of local machine which is associated with this session.
      • getRemoteAddress

        public java.net.InetSocketAddress getRemoteAddress()
        Returns:
        the socket address of remote peer.
      • getFilterChain

        public IoFilterChain getFilterChain()
        Returns:
        the filter chain that only affects this session.
      • isReadable

        boolean isReadable()
        Is this session was tagged are readable after a call to Socket.pool(long).
        Returns:
        true if this session is ready for read operations
      • setReadable

        void setReadable​(boolean readable)
        Set if this session is readable after a call to Socket.pool(long).
        Parameters:
        readable - true for set this session ready for read operations
      • isWritable

        boolean isWritable()
        Is this session is tagged writable after a call to Socket.pool(long).
        Returns:
        true if this session is ready for write operations
      • setWritable

        void setWritable​(boolean writable)
        Set if this session is writable after a call to Socket.pool(long).
        Parameters:
        writable - true for set this session ready for write operations
      • isInterestedInRead

        boolean isInterestedInRead()
        Does this session needs to be registered for read events. Used for building poll set @see Poll.
        Returns:
        true if registered
      • setInterestedInRead

        void setInterestedInRead​(boolean isOpRead)
        Set if this session needs to be registered for read events. Used for building poll set @see Poll.
        Parameters:
        isOpRead - true if need to be registered
      • isInterestedInWrite

        boolean isInterestedInWrite()
        Does this session needs to be registered for write events. Used for building poll set @see Poll.
        Returns:
        true if registered
      • setInterestedInWrite

        void setInterestedInWrite​(boolean isOpWrite)
        Set if this session needs to be registered for write events. Used for building poll set @see Poll.
        Parameters:
        isOpWrite - true if need to be registered