Class ThreadPool


  • public class ThreadPool
    extends java.lang.Object
    This maintains a pool of authenticate threads that authenticate against a particular resource.
    Version:
    $Revision$
    Author:
    Karan Vahi
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  ThreadPool.AuthenticateThread
      A thread as an inner class, that authenticates against one particular pool.
      (package private) class  ThreadPool.ConditionVariable
      A wrapper around an int that acts as a Condition Variable, and is used as such.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.ietf.jgss.GSSCredential mCredential
      The credential loaded from the non default location if specified.
      private ThreadPool.ConditionVariable mCurrentNum
      The condition variable that is used to synchronize the shutdown.
      private java.util.Set mExecPools
      The Set of pools that need to be authenticated against.
      private ENV mLocalEnv
      The namespace object holding the environment variables for local pool.
      private LogManager mLogger
      The handle to the LogManager object.
      private java.lang.Integer mNumOfPools
      The number of pools that one has to authenticate against.
      private PoolInfoProvider mPoolHandle
      The handle to the Pool Info Provider.
      private PegasusProperties mProps
      The handle to the properties object.
      private java.util.LinkedList mQueue
      The request queue that holds the authenticate requests.
      private ThreadPool.AuthenticateThread[] mWorkers
      The handle to the pool of threads that this thread pool is reponsible for.
      static int NUMBER_OF_THREADS
      The maximum number of authentication threads that are spawned.
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadPool​(PegasusProperties properties, java.util.Set pools)
      The overloaded constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptRequest​(java.lang.Object request)
      Accepts an authentication request, that has to be serviced.
      private org.ietf.jgss.GSSCredential getGSSCredential​(java.lang.String file)
      Loads a GSSCredential from the proxy file residing at the path specified.
      private ENV loadLocalEnvVariables()
      Reads in the environment variables into memory from the properties file and the pool catalog.
      void shutdown()
      This method is called to ensure the clean shutdown of threads, and waits till all the requests have been serviced.
      • Methods inherited from class java.lang.Object

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

      • NUMBER_OF_THREADS

        public static final int NUMBER_OF_THREADS
        The maximum number of authentication threads that are spawned.
        See Also:
        Constant Field Values
      • mQueue

        private java.util.LinkedList mQueue
        The request queue that holds the authenticate requests. The worker threads do access this job queue.
      • mPoolHandle

        private PoolInfoProvider mPoolHandle
        The handle to the Pool Info Provider.
      • mLogger

        private LogManager mLogger
        The handle to the LogManager object.
      • mExecPools

        private java.util.Set mExecPools
        The Set of pools that need to be authenticated against.
      • mNumOfPools

        private java.lang.Integer mNumOfPools
        The number of pools that one has to authenticate against.
      • mLocalEnv

        private ENV mLocalEnv
        The namespace object holding the environment variables for local pool.
      • mCredential

        private org.ietf.jgss.GSSCredential mCredential
        The credential loaded from the non default location if specified.
    • Constructor Detail

      • ThreadPool

        public ThreadPool​(PegasusProperties properties,
                          java.util.Set pools)
        The overloaded constructor.
        Parameters:
        properties - the PegasusProperties to be used.
        pools - the set of pools against which the user is authenticating.
    • Method Detail

      • shutdown

        public void shutdown()
        This method is called to ensure the clean shutdown of threads, and waits till all the requests have been serviced.
      • acceptRequest

        public void acceptRequest​(java.lang.Object request)
        Accepts an authentication request, that has to be serviced. It is added to queue of requests.
      • loadLocalEnvVariables

        private ENV loadLocalEnvVariables()
        Reads in the environment variables into memory from the properties file and the pool catalog.
        Returns:
        the ENV namespace object holding the environment variables.
      • getGSSCredential

        private org.ietf.jgss.GSSCredential getGSSCredential​(java.lang.String file)
        Loads a GSSCredential from the proxy file residing at the path specified.
        Parameters:
        file - the path to the proxy file.
        Returns:
        GSSCredential null in case the file format is wrong, or file does not exist.