Class ThreadPool.AuthenticateThread

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

    class ThreadPool.AuthenticateThread
    extends java.lang.Object
    implements java.lang.Runnable
    A thread as an inner class, that authenticates against one particular pool.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean mAvailable
      Whether the thread is available to do some work or not.
      private int mIndex
      The unique identifying id of the thread.
      private java.lang.String mPool
      The pool against which to authenticate.
      private boolean mShutdown
      Whether to shutdown or not.
      private java.lang.Thread mThread
      The thread object that is used to launch the thread.
    • Constructor Summary

      Constructors 
      Constructor Description
      AuthenticateThread​(int index)
      The overloaded constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AuthenticateRequest getAuthenticateRequest()
      Returns an authentication request to the worker thread.
      boolean isAvailable()
      Returns whether a thread is available to do some work or not.
      void join​(long millis)
      Calls the corresponding join method of the thread associated with this class.
      void run()
      The runnable method of the thread, that is called when the thread is started.
      void shutdown()
      Sets the shutdown flag to true.
      void start()
      The start method for the thread.
      • Methods inherited from class java.lang.Object

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

      • mPool

        private java.lang.String mPool
        The pool against which to authenticate.
      • mThread

        private java.lang.Thread mThread
        The thread object that is used to launch the thread.
      • mAvailable

        private boolean mAvailable
        Whether the thread is available to do some work or not.
      • mShutdown

        private boolean mShutdown
        Whether to shutdown or not.
      • mIndex

        private int mIndex
        The unique identifying id of the thread.
    • Constructor Detail

      • AuthenticateThread

        public AuthenticateThread​(int index)
        The overloaded constructor.
    • Method Detail

      • start

        public void start()
        The start method for the thread. It initialises the thread and calls it's start method.
      • isAvailable

        public boolean isAvailable()
        Returns whether a thread is available to do some work or not.
      • shutdown

        public void shutdown()
        Sets the shutdown flag to true. This does not make the thread stop. The thread only stops when it's current request is serviced and the queue is empty.
      • join

        public void join​(long millis)
                  throws java.lang.InterruptedException
        Calls the corresponding join method of the thread associated with this class.
        Parameters:
        millis - The time to wait in milliseconds.
        Throws:
        java.lang.InterruptedException
      • run

        public void run()
        The runnable method of the thread, that is called when the thread is started.
        Specified by:
        run in interface java.lang.Runnable
      • getAuthenticateRequest

        public AuthenticateRequest getAuthenticateRequest()
        Returns an authentication request to the worker thread.
        Returns:
        the authentication request.