Roy Golan has posted comments on this change. Change subject: core: make DbFacade a CDI singleton ......................................................................
Patch Set 15: (3 comments) http://gerrit.ovirt.org/#/c/34814/15/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/ModuleConfigurationExtension.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/ModuleConfigurationExtension.java: Line 21: import org.slf4j.LoggerFactory; Line 22: Line 23: import com.google.common.base.Strings; Line 24: Line 25: public class ModuleConfigurationExtension implements Extension { I see the now :) you must test that on jboss eap 6.3, where the bug is fixed. there's a good chance that this will cause the beans to load twice and I don't know what's the impact. Line 26: private static final Logger log = LoggerFactory.getLogger(ModuleConfigurationExtension.class); Line 27: private final Map<String, AnnotatedType<Object>> beans = new HashMap<>(); Line 28: Line 29: /** http://gerrit.ovirt.org/#/c/34814/15/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java: Line 292: Line 293: /** Line 294: * just convenience so we don't refactor old code Line 295: */ Line 296: public synchronized static DbFacade getInstance() { it shouldln't be synced. it is given theat PostConstruct is running once you need an instance the first time. and notice that if instance is null than you assign it and then the init() assigns again in line 285 Line 297: if (instance == null) { Line 298: log.error("DbFacade not initialized by injection!"); Line 299: instance = new DbFacade(); Line 300: instance.init(); http://gerrit.ovirt.org/#/c/34814/15/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacadeLocator.java: Line 16: import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator; Line 17: Line 18: /** Line 19: * A locator singleton for looking up (and initializing) DbFacade instance Line 20: */ Named is usually for web archive to use. using the Type is preferred in most cases (its type safe) Line 21: @Named Line 22: @Singleton Line 23: public class DbFacadeLocator { Line 24: private static final Logger log = LoggerFactory.getLogger(DbFacadeLocator.class); -- To view, visit http://gerrit.ovirt.org/34814 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic9e57710ce8353af020cb5ae53e43b127276d6c6 Gerrit-PatchSet: 15 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <[email protected]> Gerrit-Reviewer: Liran Zelkha <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
