Could some one take a look this below program ?. 

It is working fine for small process, but not exiting the program after completing large process.

Note: If it is small size query, about 50 records (retrieving and updating), the program is Exiting normally....

The purpose of this program is to get the data from the database, go to cloud to read JSON, validate the data and update the record in database with result.

```
public class ThreadLauncher
{

  public static void main(String args[])
   {
    final ExecutorService service = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); // or hardcode a number

    List<Future<Runnable>> futures = new ArrayList<Future<Runnable>>();

    for (int n = 0; n < 10; n++)
    {
        Future f = service.submit(new Task(n));
        futures.add(f);
    }

    // wait for all tasks to complete before continuing
    for (Future<Runnable> f : futures)
    {
        try {

            f.get();
            //shut down the executor service so that this thread can exit

        } catch (InterruptedException e) {
            System.out.println("Exiting with InterruptedException : " + e.getMessage());
            e.printStackTrace();
        } catch (ExecutionException e) {
            System.out.println("Exiting with ExecutionException : " + e.getMessage());
            e.printStackTrace();
        }
    }
    service.shutdownNow();

    System.out.println("Exiting normally...");

}
}

 final class Task
    implements Runnable
{
private int loopCounter;
private int totalLoops = 5;

public Task(int counter)
{
    this.loopCounter = counter;
}

@Override
public void run()
 {
    try { 
        GCPJSON.getInstance().getGCPDataFromJSON(PRODDataAccess.getInstance().getDataToProcess(loopCounter,totalLoops));

        System.out.println("Task ID : " + this.loopCounter + " performed by " + 
     Thread.currentThread().getName());
    } catch (Exception e) {

        e.printStackTrace();
    }

 }
}

```