I believe it was NOT volatile. Someone else suggested making it volatile.
On 4/19/13 1:46 PM, Brian Goetz wrote:
> Is "controller" volatile?
>
> On 4/19/2013 4:43 PM, Byron Nevins wrote:
>> Adding The Master to the thread
>>
>> On 4/19/13 3:42 AM, John Wells wrote:
>>> I would like an exception for the following "findbugs" find:
>>>
>>> I have a method like this:
>>>
>>> private RunLevelController getController() {
>>> if (controller != null) return controller;
>>>
>>> synchronized (this) {
>>> if (controller != null) return controller;
>>>
>>> controller = controllerProvider.get();
>>> return controller;
>>> }
>>> }
>>>
>>> What I get from findbugs is this:
>>>
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:590:
>>>
>>> DC_DOUBLECHECK: Possible doublecheck on
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller
>>>
>>> in
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.getController()
>>>
>>>
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:590:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:590:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:593:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:593:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:595:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>> jwells:
>>> nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java:596:
>>>
>>> IS2_INCONSISTENT_SYNC: Inconsistent synchronization of
>>> com.sun.enterprise.v3.server.AppServerStartup$AppInstanceListener.controller;
>>>
>>> locked 57% of time
>>>
>>> This is the only thing in the file that ever sets the controller
>>> variable, and the variable never becomes unset. To me this is valid
>>> java...
>>>
>>> John Wells
>>> john.wells_at_oracle.comNOSPAM
>>>
>>>
>>
--
---
All Generalizations are false. Including this one.