sun.misc.Unsafe.park(原生方法)的原因

时间:2015-05-05 13:58:19

标签: java native

我有以下方法,

 private void addToContainer(DefaultFormBuilder build) {

            /* Build the UI*/ 
            //The UI is built by reading from an XML.   

                /* Add items to Array list */
                arrayList.add(views); //views is JComponent

            } catch (Exception e) {                 
                e.printStackTrace();                    
            }           
        }
    }
}

来自 jstack:

"AWT-EventQueue-0" prio=10 tid=0x00007f63a8742800 nid=0x7f9b waiting on condition [0x00007f63a465c000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000007dddec5f8> (a java.util.concurrent.CountDownLatch$Sync)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:994)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)
    at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:236)
    at com.test.addToContainer(test.java:450)

我不确定这种方法出了什么问题。向arrayList添加视图会导致此问题吗?

预期:执行此方法后,将启动用户界面。但是,在此方案中未启动它。我总是没有得到这个错误,但很少见到。(到目前为止,我只遇到过一次)

我是新手,请帮助。

0 个答案:

没有答案