title: How to call a method using multiple threads instead of sequentially
body: <p>I have a process method in two of my classes which accepts a Map of String.</p>
  
  <p>In the below code, I am using a for loop which will call the process method in two of my classes one by one (sequentially) which is fine.</p>
  
  <pre><code>for (ModuleRegistration.ModulesHolderEntry entry : ModuleRegistration.getInstance()) {
      final Map&lt;String, String&gt; response = entry.getPlugin().process(outputs);
  
      System.out.println(response);
  }
  </code></pre>
  
  <p>But is there any way I can launch two thread for this? One thread will call process method of one of my class and second thread will call process method in my second class? And then after getting response from each thread, I want to write to the database. meaning each thread will write to database.</p>
  
  <p>And also there should be timeout feature as well for each thread. We will wait for each thread a specified amount of time, meaning if one of the process method is not returned withing a certain time, then it will get timedout.</p>
  
  <p>Is this possible to do in my use case? If yes, can anyone provide me an example of how to do this? Thanks.</p>
  
  <p>Any help will be appreciated on this.</p>