Class MultiThreadedConnectionPoolServer.ClientThread

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    MultiThreadedConnectionPoolServer

    private class MultiThreadedConnectionPoolServer.ClientThread
    extends java.lang.Thread
    This thread blocks waiting for a complete command to arrive from the client it is connected to.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean client_closed
      If this is set to true, the thread run method should close off.
      private boolean processing_command
      This is set to true if we are processing a request from the client.
      private ServerConnection server_connection
      The ServerConnection object being serviced by this thread.
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkCurrentConnection()
      Checks each connection in the 'service_connection_list' list.
      void close()
      Call this method to stop the thread.
      void run()
      The Runnable method of the farmer thread.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • server_connection

        private ServerConnection server_connection
        The ServerConnection object being serviced by this thread.
      • client_closed

        private boolean client_closed
        If this is set to true, the thread run method should close off.
      • processing_command

        private boolean processing_command
        This is set to true if we are processing a request from the client.
    • Constructor Detail

      • ClientThread

        public ClientThread​(ServerConnection connection)
        The Constructor.
    • Method Detail

      • checkCurrentConnection

        private void checkCurrentConnection()
                                     throws java.lang.InterruptedException
        Checks each connection in the 'service_connection_list' list. If there is a command pending, and any previous commands on this connection have completed, then this will spawn off a new process to deal with the command.
        Throws:
        java.lang.InterruptedException
      • close

        public void close()
        Call this method to stop the thread.
      • run

        public void run()
        The Runnable method of the farmer thread.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread