Callable的三种使用方式
1。
FutureTask ft=new FutureTask(new Callable<Object>(){@Override public Object call() throws Exception{// TODO Auto-generated method stubreturn null;}});ft.run();System.out.println(ft.get().toString());?2。
ExecutorService es=Executors.newCachedThreadPool();Future f=es.submit(new Callable<Object>(){@Override public Object call() throws Exception{// TODO Auto-generated method stubreturn null;}});?3。
Future f=es.submit(new FutureTask(new Callable<Object>(){@Override public Object call() throws Exception{// TODO Auto-generated method stubreturn null;}}));?