Class LoggingIOSession

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel, org.apache.hc.core5.http.SocketModalCloseable, org.apache.hc.core5.io.ModalCloseable, org.apache.hc.core5.reactor.IOSession, org.apache.hc.core5.util.Identifiable

    class LoggingIOSession
    extends java.lang.Object
    implements org.apache.hc.core5.reactor.IOSession
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.hc.core5.reactor.IOSession

        org.apache.hc.core5.reactor.IOSession.Status
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.slf4j.Logger log  
      private org.apache.hc.core5.reactor.IOSession session  
      private org.slf4j.Logger wireLog  
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggingIOSession​(org.apache.hc.core5.reactor.IOSession session, org.slf4j.Logger log, org.slf4j.Logger wireLog)  
    • Field Detail

      • log

        private final org.slf4j.Logger log
      • wireLog

        private final org.slf4j.Logger wireLog
      • session

        private final org.apache.hc.core5.reactor.IOSession session
    • Constructor Detail

      • LoggingIOSession

        public LoggingIOSession​(org.apache.hc.core5.reactor.IOSession session,
                                org.slf4j.Logger log,
                                org.slf4j.Logger wireLog)
    • Method Detail

      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface org.apache.hc.core5.util.Identifiable
      • getLock

        public java.util.concurrent.locks.Lock getLock()
        Specified by:
        getLock in interface org.apache.hc.core5.reactor.IOSession
      • hasCommands

        public boolean hasCommands()
        Specified by:
        hasCommands in interface org.apache.hc.core5.reactor.IOSession
      • poll

        public org.apache.hc.core5.reactor.Command poll()
        Specified by:
        poll in interface org.apache.hc.core5.reactor.IOSession
      • enqueue

        public void enqueue​(org.apache.hc.core5.reactor.Command command,
                            org.apache.hc.core5.reactor.Command.Priority priority)
        Specified by:
        enqueue in interface org.apache.hc.core5.reactor.IOSession
      • channel

        public java.nio.channels.ByteChannel channel()
        Specified by:
        channel in interface org.apache.hc.core5.reactor.IOSession
      • getLocalAddress

        public java.net.SocketAddress getLocalAddress()
        Specified by:
        getLocalAddress in interface org.apache.hc.core5.reactor.IOSession
      • getRemoteAddress

        public java.net.SocketAddress getRemoteAddress()
        Specified by:
        getRemoteAddress in interface org.apache.hc.core5.reactor.IOSession
      • getEventMask

        public int getEventMask()
        Specified by:
        getEventMask in interface org.apache.hc.core5.reactor.IOSession
      • formatOps

        private static java.lang.String formatOps​(int ops)
      • setEventMask

        public void setEventMask​(int ops)
        Specified by:
        setEventMask in interface org.apache.hc.core5.reactor.IOSession
      • setEvent

        public void setEvent​(int op)
        Specified by:
        setEvent in interface org.apache.hc.core5.reactor.IOSession
      • clearEvent

        public void clearEvent​(int op)
        Specified by:
        clearEvent in interface org.apache.hc.core5.reactor.IOSession
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface java.nio.channels.Channel
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.nio.channels.Channel
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.hc.core5.reactor.IOSession
      • getStatus

        public org.apache.hc.core5.reactor.IOSession.Status getStatus()
        Specified by:
        getStatus in interface org.apache.hc.core5.reactor.IOSession
      • close

        public void close​(org.apache.hc.core5.io.CloseMode closeMode)
        Specified by:
        close in interface org.apache.hc.core5.io.ModalCloseable
      • getSocketTimeout

        public org.apache.hc.core5.util.Timeout getSocketTimeout()
        Specified by:
        getSocketTimeout in interface org.apache.hc.core5.reactor.IOSession
        Specified by:
        getSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
      • setSocketTimeout

        public void setSocketTimeout​(org.apache.hc.core5.util.Timeout timeout)
        Specified by:
        setSocketTimeout in interface org.apache.hc.core5.reactor.IOSession
        Specified by:
        setSocketTimeout in interface org.apache.hc.core5.http.SocketModalCloseable
      • getLastReadTime

        public long getLastReadTime()
        Specified by:
        getLastReadTime in interface org.apache.hc.core5.reactor.IOSession
      • getLastWriteTime

        public long getLastWriteTime()
        Specified by:
        getLastWriteTime in interface org.apache.hc.core5.reactor.IOSession
      • updateReadTime

        public void updateReadTime()
        Specified by:
        updateReadTime in interface org.apache.hc.core5.reactor.IOSession
      • updateWriteTime

        public void updateWriteTime()
        Specified by:
        updateWriteTime in interface org.apache.hc.core5.reactor.IOSession
      • getLastEventTime

        public long getLastEventTime()
        Specified by:
        getLastEventTime in interface org.apache.hc.core5.reactor.IOSession
      • getHandler

        public org.apache.hc.core5.reactor.IOEventHandler getHandler()
        Specified by:
        getHandler in interface org.apache.hc.core5.reactor.IOSession
      • upgrade

        public void upgrade​(org.apache.hc.core5.reactor.IOEventHandler handler)
        Specified by:
        upgrade in interface org.apache.hc.core5.reactor.IOSession
      • logData

        private void logData​(java.nio.ByteBuffer data,
                             java.lang.String prefix)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Throws:
        java.io.IOException
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object