The usual vanilla solution would be:
new Thread( new Runnable() { public void run() { try { Thread.sleep( 1000 ); } catch (InterruptedException ie) {} myHashSet.add( foo ); } } ).start();
There is much less going on behind the scenes here than with ThreadPoolExecutor. TPE may be more convenient to control the number of threads, but if you turn off a lot of threads that are sleeping or waiting, limiting their number can hurt performance a lot more than it helps.
And you want to sync with myHashSet
if you haven't processed it yet. Remember that you need to sync everywhere so that it benefits. There are other ways to handle this, such as Collections.synchronizedMap or ConcurrentHashMap.
source share