Demo entry 5233174

Current

   

Submitted by anonymous on Jun 10, 2016 at 14:27
Language: Java. Code size: 353 Bytes.

private ExecutorService threadPool = Executors.newFixedThreadPool(8);

final List<T> batches = new ArrayList<T>();

Callable<T> t = new Callable<T>() {
 public T run() { 
	synchronized(batches) { 
	T result = callDatabase(msg); 
	batches.add(result); 
	return result; 
	} 
 } 
}; 

Future<T> f = threadPool.submit(t); T result = f.get() 

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).