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