标签:
public class TestLockSupport { public static class MyRunnable implements Runnable { private final Thread currentThread; public MyRunnable(Thread thread) { this.currentThread = thread; } @Override public void run() { try { Thread.sleep(5000); LockSupport.unpark(this.currentThread); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { Thread thread = new Thread(new MyRunnable(Thread.currentThread())); thread.start(); System.out.println(new Date()); LockSupport.park(); System.out.println(new Date()); } }
标签:
原文地址:http://blog.csdn.net/u011345136/article/details/46293389