Code example for ThreadPoolExecutor

Methods: submit

0
		} 
	} 
	 
	public void Download(abstractDownloadTask dlTask) {
		if (dlTask != null)
			pool.submit(dlTask);
	} 
 
	@Override 
	protected void finalize() throws Throwable { 
		pool.shutdown(); // shutdown idle threads/tasks
		pool.shutdownNow(); // Cancel currently executing tasks
	    // Wait a while for tasks to respond to being cancelled 
	    if (!pool.awaitTermination(10, TimeUnit.SECONDS))
	       System.err.println("Some downloaders did not terminate");
	        
		super.finalize(); 
	} 
	 
	public long getSize() { 
		return pool.getTaskCount();