Callable的三种使用方式

1。

		FutureTask ft=new FutureTask(new Callable<Object>(){

			@Override public Object call() throws Exception{// TODO Auto-generated method stub
			return 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 stub
			return null;}
			
		});

 3。

		Future f=es.submit(new FutureTask(new Callable<Object>(){

			@Override public Object call() throws Exception{// TODO Auto-generated method stub
			return null;}
		}));
 

你可能感兴趣的:(F#)