[concurrency-interest] Nested synchronized

Gregg Wonderly gergg at cox.net
Thu Jan 5 23:51:37 EST 2012


On my mac, it seems to complete successfully.  I've included a stack dump just FYI.

Gregg Wonderly

gwmac:~ gregg$ javac -d . Prob.java
gwmac:~ gregg$ java my.Prob
^\
2012-01-05 22:48:09
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.4-b02-402 mixed mode):

"pool-1-thread-2" prio=5 tid=7ffd42969800 nid=0x10c132000 runnable [10c131000]
   java.lang.Thread.State: RUNNABLE
	at my.ParrallelSumMethod.conditionallySumArguments(Prob.java:87)
	- locked <7f44e1400> (a my.ParrallelSumMethod)
	at my.ParrallelSumMethod.isSetA2(Prob.java:80)
	- locked <7f44e1400> (a my.ParrallelSumMethod)
	at my.ParrallelSumMethod.setA2(Prob.java:57)
	at my.Prob$2.call(Prob.java:28)
	at my.Prob$2.call(Prob.java:26)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

"pool-1-thread-1" prio=5 tid=7ffd4287f000 nid=0x10c02f000 runnable [10c02e000]
   java.lang.Thread.State: RUNNABLE
	at java.lang.Thread.isInterrupted(Native Method)
	at java.lang.Thread.interrupted(Thread.java:934)
	at my.ParrallelSumMethod.checkForInterrupt(Prob.java:65)
	at my.ParrallelSumMethod.setA1(Prob.java:51)
	at my.Prob$1.call(Prob.java:22)
	at my.Prob$1.call(Prob.java:20)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:680)

"Low Memory Detector" daemon prio=5 tid=7ffd4409f000 nid=0x10bc3d000 runnable [00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=9 tid=7ffd4409e800 nid=0x10bb3a000 waiting on condition [00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" daemon prio=9 tid=7ffd4409d800 nid=0x10ba37000 waiting on condition [00000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=9 tid=7ffd4409d000 nid=0x10b934000 waiting on condition [00000000]
   java.lang.Thread.State: RUNNABLE

"Surrogate Locker Thread (Concurrent GC)" daemon prio=5 tid=7ffd4409c000 nid=0x10b831000 waiting on condition [00000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=7ffd44095800 nid=0x10b54f000 in Object.wait() [10b54e000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <7f44e10c0> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
	- locked <7f44e10c0> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=7ffd44094800 nid=0x10b44c000 in Object.wait() [10b44b000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <7f44e1ff8> (a java.lang.ref.Reference$Lock)
	at java.lang.Object.wait(Object.java:485)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
	- locked <7f44e1ff8> (a java.lang.ref.Reference$Lock)

"main" prio=5 tid=7ffd44000800 nid=0x104aee000 waiting on condition [104aed000]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <7f44e2070> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
	at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:196)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2025)
	at java.util.concurrent.ThreadPoolExecutor.awaitTermination(ThreadPoolExecutor.java:1253)
	at my.Prob.main(Prob.java:36)

"VM Thread" prio=9 tid=7ffd42802800 nid=0x10b349000 runnable 

"Gang worker#0 (Parallel GC Threads)" prio=9 tid=7ffd44002000 nid=0x107e27000 runnable 

"Gang worker#1 (Parallel GC Threads)" prio=9 tid=7ffd44002800 nid=0x107f2a000 runnable 

"Concurrent Mark-Sweep GC Thread" prio=9 tid=7ffd4404d000 nid=0x10afef000 runnable 
"VM Periodic Task Thread" prio=10 tid=7ffd440a1000 nid=0x10bd40000 waiting on condition 

"Exception Catcher Thread" prio=10 tid=7ffd44001800 nid=0x104c50000 runnable 
JNI global references: 914

Heap
 par new generation   total 19136K, used 5150K [7f3000000, 7f44c0000, 7f44c0000)
  eden space 17024K,  30% used [7f3000000, 7f35078b8, 7f40a0000)
  from space 2112K,   0% used [7f40a0000, 7f40a0000, 7f42b0000)
  to   space 2112K,   0% used [7f42b0000, 7f42b0000, 7f44c0000)
 concurrent mark-sweep generation total 63872K, used 379K [7f44c0000, 7f8320000, 7fae00000)
 concurrent-mark-sweep perm gen total 21248K, used 4811K [7fae00000, 7fc2c0000, 800000000)

99999990000000, terminated ok
gwmac:~ gregg$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
gwmac:~ gregg$ 


More information about the Concurrency-interest mailing list