Juan Hernandez has posted comments on this change. Change subject: core: Inject Task schedulers instead of JNDI lookups ......................................................................
Patch Set 4: (6 comments) https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/Backend.java: Line 191: public void initialize() { Line 192: log.info("Start initializing {}", getClass().getSimpleName()); Line 193: // start task schedulers Line 194: for (SchedulerUtil taskScheduler : taskSchedulers) { Line 195: log.info("Started task scheduler {}", taskScheduler); This is a bit confusing, the code does nothing but send the log message. Consider adding a comment explaining that the real start code is implicitly triggered by the injection. That or move these log messages to the scheduler implementation. Line 196: } Line 197: // initialize configuration utils to use DB Line 198: Config.setConfigUtils(new DBConfigUtils()); Line 199: // we need to initialize os-info before the compensations take place because of VmPoolCommandBase#osRepository https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/di/qualifier/InMemory.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/di/qualifier/InMemory.java: Line 1: package org.ovirt.engine.core.di.qualifier; Line 2: Line 3: import javax.inject.Qualifier; Line 4: Line 5: @Qualifier Consider to explicitly indicate the @Retention and @Target. Line 6: public @interface InMemory { https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/di/qualifier/Persistent.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/di/qualifier/Persistent.java: Line 1: package org.ovirt.engine.core.di.qualifier; Line 2: Line 3: import javax.inject.Qualifier; Line 4: Line 5: @Qualifier Consider to explicitly indicate the @Retention and @Target. Line 6: public @interface Persistent { https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/scheduler/pom.xml File backend/manager/modules/scheduler/pom.xml: Line 7: <version>3.6.0-SNAPSHOT</version> Line 8: </parent> Line 9: Line 10: <artifactId>scheduler</artifactId> Line 11: <packaging>jar</packaging> As this becomes a plain .jar now I'd suggest that you create a JBoss module and reference it instead of including the .jar inside the .ear. Line 12: Line 13: <name>engine scheduler bean</name> Line 14: <properties> Line 15: <engine.db>pgsql</engine.db> https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java File backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/DBSchedulerUtilQuartzImpl.java: Line 86: * @return a {@code DBSchedulerUtilQuartzImpl} instance Line 87: */ Line 88: @Deprecated Line 89: public static SchedulerUtil getInstance() { Line 90: return instance; Take into account that is potentially very dangerous. You are saving a reference to the implementation, but that implementation may have been decorated with a proxy by the CDI container. So when someone uses it calling this "getInstance" method it will get a direct reference, without the decorator proxy, so any tasks that are expected to be performed by the proxy (security, transactions, injection, etc) won't actually happen. This is unlikely, but I think it is better if you implement this method with the code that you propose as an alternative in the @deprecated comment. Line 91: } Line 92: Line 93: /** Line 94: * To avoid data serialization issues for jobdata that is persisted in the database inputParams should be of https://gerrit.ovirt.org/#/c/41035/4/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilQuartzImpl.java File backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/SchedulerUtilQuartzImpl.java: Line 72: * @return a {@code SchedulerUtilQuartzImpl} instance Line 73: */ Line 74: @Deprecated Line 75: public static SchedulerUtil getInstance() { Line 76: return instance; Be careful with this, see my comment in the other implementation. Line 77: } Line 78: Line 79: @Override Line 80: protected JobDetail createJobWithBasicMapValues(Object instance, -- To view, visit https://gerrit.ovirt.org/41035 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2288d0bd0584c7ba17f3dabaff268e40cbdddbea Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches