码迷,mamicode.com
首页 > 其他好文 > 详细

LockSupport工具类详解

时间:2020-01-28 17:43:56      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:htm   gis   jdk   operation   不同   syn   nat   src   color   

"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

技术图片

 

LockSupport工具类详解

标签:htm   gis   jdk   operation   不同   syn   nat   src   color   

原文地址:https://www.cnblogs.com/zhjh256/p/12237939.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!