title: How to store Java Callable job in ConcurrentHashMap
body: <p>I am new to the Multithreading and here is a question:
  For a Callable interface, like:</p>
  
  <pre><code>public interface Callable&lt;V&gt; {
      public V call();
  }
  </code></pre>
  
  <p>Now I need to implement a class with three method:</p>
  
  <pre><code>/* register some callable jobs with the signal key */
  void register(int signal, Callable cb); 
  
  /* unregister */
  void unregister(int signal, Callable cb);
  
  /* run all the jobs with the given signal */
  void signal(int signal);
  </code></pre>
  
  <p>I am thinking the register and unregister function I will use a ConcurrentHashMap in java, some structure like :</p>
  
  <pre><code>ConcurrentHashMap&lt;Integer, List&lt;Callable&gt;&gt; 
  </code></pre>
  
  <p>Then here are my questions:</p>
  
  <ol>
  <li>how to support the above three method? How to pass a Callable as a variable? The void signal(int signal) will run all the callable with the given signal key.</li>
  <li>for Callable interface, need to implement the V call() function. How does this call() relate to the signal() method? Should signal call this call()?</li>
  </ol>