"DubboSaveRegistryCache-thread-1" #81 daemon prio=5 os_prio=0 tid=0x000000003ecff000 nid=0x29758 waiting on condition [0x000000004472f000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000006c4dfc6a0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) # 和park许可证关联的对象,如果没有关联对象,则不会有这一行,就不知道锁的上下文 at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) "Curator-Framework-0" #80 daemon prio=5 os_prio=0 tid=0x000000003ecf8800 nid=0x2b4e8 waiting on condition [0x000000004335e000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000006c4e97650> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.DelayQueue.take(DelayQueue.java:211) at java.util.concurrent.DelayQueue.take(DelayQueue.java:70) at org.apache.curator.framework.imps.CuratorFrameworkImpl.backgroundOperationsLoop(CuratorFrameworkImpl.java:804) at org.apache.curator.framework.imps.CuratorFrameworkImpl.access$300(CuratorFrameworkImpl.java:64) at org.apache.curator.framework.imps.CuratorFrameworkImpl$4.call(CuratorFrameworkImpl.java:267) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
LockSupport仅仅继承了Object类,是创建锁和其它同步类的基本线程原语。该类建议创建它的线程关联一个许可证。调用park将自己置入等待许可证的状态,调用unpark(thread)将给thread一个许可证,使得其可以继续运行。unpark(thread)可以和调用park的线程顺序不同,也就是可以先申请许可证,此时park会立刻释放。为了排查方便,JDK将以将park和一个对象关联。如上所示。更多信息参见https://www.cnblogs.com/zhjh256/p/6389497.html。
原文地址:https://www.cnblogs.com/zhjh256/p/12237939.html
时间: 2024-10-13 23:35:18