Moti Asayag has posted comments on this change. Change subject: core: Support transactions for Quartz jobs ......................................................................
Patch Set 27: (3 comments) https://gerrit.ovirt.org/#/c/36370/27/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/job/JobRepositoryCleanupManager.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/job/JobRepositoryCleanupManager.java: Line 50: * <li>The successful jobs will be deleted after {@code ConfigValues.SucceededJobCleanupTimeInMinutes}.</li> Line 51: * <li>The failed jobs will be deleted after {@code ConfigValues.FailedJobCleanupTimeInMinutes}.</li> Line 52: * <ul> Line 53: */ Line 54: @OnTimerMethodAnnotation(value = "completed_jobs_cleanup", transactional = true) please remove this at the moment. we'll probably require a wider range of changes for it (for other monitors) Line 55: public void cleanCompletedJob() { Line 56: Line 57: Date succeededJobsDeleteTime = Line 58: new Date(System.currentTimeMillis() - TimeUnit.MILLISECONDS.convert(succeededJobTime, TimeUnit.MINUTES)); https://gerrit.ovirt.org/#/c/36370/27/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java File backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java: Line 43: final Object[] methodParams = (Object[]) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_PARAM); Line 44: String methodKey = getMethodKey(instance.getClass().getName(), methodName); Line 45: final Method methodToRun; Line 46: if (!cachedMethods.containsKey(methodKey)) { Line 47: synchronized (JobWrapper.class) { couldn't it be simplified to: cachedMethods.putIfAbscent(methodKey, getMethodToRun(instance, methodName)) ? instead of the synchronized block ? Line 48: if (cachedMethods.containsKey(methodKey)) { Line 49: methodToRun = cachedMethods.get(methodKey); Line 50: } else { Line 51: methodToRun = getMethodToRun(instance, methodName); Line 59: } Line 60: } Line 61: } else { Line 62: methodToRun = cachedMethods.get(methodKey); Line 63: } please extract the block below into a method, ie.: invokeMethod(instance, method, parameters){..} Line 64: OnTimerMethodAnnotation annotation = methodToRun.getAnnotation(OnTimerMethodAnnotation.class); Line 65: if (annotation.transactional()) { Line 66: Exception e = TransactionSupport.executeInNewTransaction(new TransactionMethod<Exception>() { Line 67: @Override -- To view, visit https://gerrit.ovirt.org/36370 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7eb67e6aeef9080b5647cb84b1cf701c720ce29d Gerrit-PatchSet: 27 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liran Zelkha <[email protected]> Gerrit-Reviewer: Eli Mesika <[email protected]> Gerrit-Reviewer: Liran Zelkha <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[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
