Java multithreading not closing threads
<p>I have the following code in a command line application. Once the loop completes, my app is still running. Why is it not shutting down. From the logs, I can see that endIndex has reached. But the app is still running?</p>

<pre><code>Executor exec = Executors.newFixedThreadPool(4);
for (int i = startIndex; i &lt;= endIndex; i++) {
        final String spURL = urlPart + i;

        Runnable requestHandler = new Runnable() {
            @Override
            public void run() {
                try {
                    getImageForURL(spURL, 0);
                } catch (IOException ex) {
                } catch (Exception ex) {
                }
            }
        };
        exec.execute(requestHandler);
    }
</code></pre>
