public static void main(String[] args) throws Exception {
ExecutorService threadpool = Executors.newFixedThreadPool(1);
Callable r = new Callable() {
@Override
public String call() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return "11111";
}
};
FutureTask<String> f = new FutureTask<>(r);
new Thread(f).start();
System.out.println(f.get());
System.out.println("end");
Runnable r = new Runnable() {
@Override
public void run() {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("runnable");
}
};
Thread t = new Thread(r);
t.start();
LockSupport.unpark(t);
System.out.println("hhh");
}