Class StreamJDBCServerConnection

    • Field Detail

      • OUTPUT_BUFFER_SIZE

        private static final int OUTPUT_BUFFER_SIZE
        The size in bytes of the buffer used for writing information onto the output stream to the client.
        See Also:
        Constant Field Values
      • INPUT_BUFFER_SIZE

        private static final int INPUT_BUFFER_SIZE
        The size in bytes of the buffer used for reading information from the input stream from the client.
        See Also:
        Constant Field Values
      • out

        private java.io.DataOutputStream out
        The output stream to the client formatted as a DataOutputStream.
    • Constructor Detail

      • StreamJDBCServerConnection

        StreamJDBCServerConnection​(DatabaseInterface db_interface,
                                   java.io.InputStream in,
                                   java.io.OutputStream out,
                                   DebugLogger logger)
                            throws java.io.IOException
        Sets up the protocol connection.
        Throws:
        java.io.IOException
    • Method Detail

      • sendEvent

        public void sendEvent​(byte[] event_msg)
                       throws java.io.IOException
        Description copied from class: JDBCProcessor
        Sends an event to the client. This is used to notify the client of trigger events, etc.

        SECURITY ISSUE: This is always invoked by the DatabaseDispatcher. We have to be careful that this method isn't allowed to block. Otherwise the DatabaseDispatcher thread will be out of operation. Unfortunately assuring this may not be possible until Java has non-blocking IO, or we use datagrams for transmission. I know for sure that the TCP implementation is vunrable. If the client doesn't 'read' what we are sending then this'll block when the buffers become full.

        Specified by:
        sendEvent in class JDBCProcessor
        Throws:
        java.io.IOException
      • requestPending

        public boolean requestPending()
                               throws java.io.IOException
        Inspects the input stream and determines in there's a command pending to be processed.
        Specified by:
        requestPending in interface ServerConnection
        Throws:
        java.io.IOException
      • processRequest

        public void processRequest()
                            throws java.io.IOException
        Processes a request from this connection.
        Specified by:
        processRequest in interface ServerConnection
        Throws:
        java.io.IOException
      • blockForRequest

        public void blockForRequest()
                             throws java.io.IOException
        Block waiting for a complete command to become available.
        Specified by:
        blockForRequest in interface ServerConnection
        Throws:
        java.io.IOException
      • ping

        public void ping()
                  throws java.io.IOException
        Pings the client to check it's still alive.
        Specified by:
        ping in interface ServerConnection
        Throws:
        java.io.IOException