United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8023310 Thread contention in the method Beans.IsDesignTime()
JDK-8023310 : Thread contention in the method Beans.IsDesignTime()

Details
Type:
Bug
Submit Date:
2013-08-19
Status:
Resolved
Updated Date:
2013-12-20
Project Name:
JDK
Resolved Date:
2013-09-25
Component:
client-libs
OS:
Sub-Component:
java.beans
CPU:
Priority:
P3
Resolution:
Fixed
Affected Versions:
7u10
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
A recent change to Beans.IsDesignTime() in JDK7 result in threads being blocked on java.beans.ThreadGroupContext.getContext().

"[ACTIVE] ExecuteThread: '222' for queue: 'weblogic.kernel.Default
(self-tuning)'" daemon prio=10 tid=0x00002aaac9ad5000 nid=0x52d9 waiting for
monitor entry [0x000000006cd09000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at
java.beans.ThreadGroupContext.getContext(ThreadGroupContext.java:55)
        - waiting to lock <0x0000000745c75ab8> (a java.beans.WeakIdentityMap)
        at java.beans.Beans.isDesignTime(Beans.java:393)
        at
oracle.adfinternal.controller.application.AdfcPageFlowScopeProvider.getPageFlo
wScope(AdfcPageFlowScopeProvider.java:68)
        at
org.apache.myfaces.trinidadinternal.context.RequestContextImpl.getPageFlowScop
e(RequestContextImpl.java:124)
        at
org.apache.myfaces.trinidadinternal.el.TrinidadELResolver.getValue(TrinidadELR
esolver.java:71)
        at
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.j
ava:176)
        at
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.ja
va:203)
...

This is because the design-time state instead of being application global is now a thread group local variable which is synchronized and result in an increase of thread contention. 

The isDesignTime method is called all over the place in ADF run time to distinguish between a call from the page designer in JDeveloper and the weblogic app server. The way this method is implemented in JDK7 is not going to work for ADF and I imagine it might be a problem for other product too.

JDeveloper contact: charles.gayraud@oracle.com

                                    

Comments
You could use the following performance test with the JMH framework:
http://openjdk.java.net/projects/code-tools/jmh/

import org.openjdk.jmh.annotations.GenerateMicroBenchmark;
import org.openjdk.jmh.annotations.Threads;

public class Beans {
    @GenerateMicroBenchmark
    @Threads(value = 10)
    public Object isDesignTime() throws ClassNotFoundException {
        return java.beans.Beans.isDesignTime();
    }
}

                                     
2013-09-25
URL:   http://hg.openjdk.java.net/jdk8/awt/jdk/rev/a284da808700
User:  malenkov
Date:  2013-09-25 10:08:34 +0000

                                     
2013-09-25
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/a284da808700
User:  lana
Date:  2013-10-01 17:37:37 +0000

                                     
2013-10-01
SQE OK to take the fix to CPU14_01
                                     
2013-10-14



Hardware and Software, Engineered to Work Together