HashMap for enum as key
<p>i had posted somewhat similar question before also.I got clarification for my doubts as well.But still I need something more . The Hashmap will be initialized with the enum object as the key and a threadpool instance as the value.I am confused as of how to initialize the HashMap for every object been called by some other process ..To make clear :
My program ,MyThreadpoolExcecutorPgm.java initializes a HashMap
My Progran AdditionHandler.java requests a thread from the HashMap by passing ThreadpoolName (enum) .I am getting "No thread available from HashMap" message.Please do help me.
Below given is my codes:</p>

<pre><code>public class MyThreadpoolExcecutorPgm {
    enum ThreadpoolName {
        DR, BR, SV, MISCELLENEOUS;
    }

    private static String threadName;
    private static HashMap&lt;ThreadpoolName, ThreadPoolExecutor&gt; threadpoolExecutorHash;

    public MyThreadpoolExcecutorPgm(String p_threadName) {
        threadName = p_threadName;

    }

    public static void fillthreadpoolExecutorHash() {
        int poolsize = 3;
        int maxpoolsize = 3;
        long keepAliveTime = 10;
        ThreadPoolExecutor tp = null;
        threadpoolExecutorHash = new HashMap&lt;ThreadpoolName, ThreadPoolExecutor&gt;();

        for (ThreadpoolName poolName :ThreadpoolName.) //failing to implement
{
            tp = new ThreadPoolExecutor(poolsize, maxpoolsize, keepAliveTime,
                    TimeUnit.SECONDS, new ArrayBlockingQueue&lt;Runnable&gt;(5));
            threadpoolExecutorHash.put(poolName, tp); 
        }

    }

    public static ThreadPoolExecutor getThreadpoolExcecutor(
            ThreadpoolName poolName) {

        ThreadPoolExecutor thread = null;
        if (threadpoolExecutorHash != null &amp;&amp; poolName != null) {
            thread = threadpoolExecutorHash.get(poolName);
        } else {
            System.out.println("No thread available from HashMap");
        }
        return thread;
    }
}
</code></pre>

<p>AdditionHandler.java
    public class AdditionHandler{</p>

<pre><code>    public void handle() {
        AddProcess setObj = new AddProcess(5, 20);
        ThreadPoolExecutor tpe = null;
        ThreadpoolName poolName =ThreadpoolName.DR; //i am using my enum    
        tpe = MyThreadpoolExcecutorPgm.getThreadpoolExcecutor(poolName);
        tpe.execute(setObj);
    }

    public static void main(String[] args) {
        AdditionHandler obj = new AdditionHandler();
        obj.handle();
    }
}
</code></pre>
