Code example for ThreadPoolExecutor

Methods: submit

0
		if (contentType != null)
		{ 
			uriRequest.addHeader("Content-Type", contentType);
		} 
 
		Future<?> request = threadPool.submit(new AsyncHttpRequest(client,
				httpContext, uriRequest, responseHandler));
		if (context != null)
		{ 
			// Add request to request map 
			List<WeakReference<Future<?>>> requestList = requestMap
					.get(context);
			if (requestList == null)
			{ 
				requestList = new LinkedList<WeakReference<Future<?>>>();
				requestMap.put(context, requestList);
			} 
			requestList.add(new WeakReference<Future<?>>(request));
			// TODO: Remove dead weakrefs from requestLists? 
		} 
Stop searching for code, let great code find you!  Add Codota to your java IDE