I have a Java program taking 100% cpu, but seemingly doing nothing.
If I take a thread dump, there are 4 threads (out of a pool of 5) waiting to take a lock.
"Incoming WorkPool 5" - Thread t@363
   java.lang.Thread.State: WAITING
    at sun.misc.Unsafe.park(Native Method)
    - waiting to lock <7212149b> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) owned by "Incoming WorkPool 3" t@354
    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.acquireQueued(AbstractQueuedSynchronizer.java:867)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
    at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
    at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
    at java.awt.EventQueue.isDispatchThreadImpl(EventQueue.java:1019)
    at java.awt.EventQueue.isDispatchThread(EventQueue.java:1014)
The thread they are waiting for is RUNNABLE
"Incoming WorkPool 3" - Thread t@354
   java.lang.Thread.State: RUNNABLE
    at java.awt.EventQueue.isDispatchThreadImpl(EventQueue.java:1024)
    at java.awt.EventQueue.isDispatchThread(EventQueue.java:1014)
This is JDK 7.0.25, so it seems one thread is stuck on
EventQueue next = eq.nextQueue;
while (next != null) {
    eq = next;
    next = eq.nextQueue;
}
There are two AWT EventQueue threads, trying to acquire the same pushpoplock.
The VM runs as a service, so it shouldn't try to do AWT stuff, but it's done by a library I'm using.
Any ideas? Can I prevent this from happening?
Thanks!
As you can see above, your two EventQueues (here R1 and R2) are in a deadlock situation - each of them has claimed one resource and cannot run further while 
the other one did claim the other resource. Both are waiting for each other endless.