runnable的线程抛出异常无法捕获

package com.itbuluoge.mythread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

class MyThread implements Runnable
{
	public void run()
	{
		throw new RuntimeException();
	}
}
public class ExceptionThread{

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try
		{
			ExecutorService exec=Executors.newCachedThreadPool();
			exec.execute(new MyThread());
		}
		catch(Exception e)
		{
			System.out.println("exception");
		}
		
	}

}

你可能感兴趣的:(JAVA/JSP)