Liran Zelkha has posted comments on this change.

Change subject: core: Support transactions for Quartz jobs
......................................................................


Patch Set 27:

(5 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 c
Done
Line 55:     public void cleanCompletedJob() {
Line 56: 
Line 57:         Date succeededJobsDeleteTime =
Line 58:                 new Date(System.currentTimeMillis() - 
TimeUnit.MILLISECONDS.convert(succeededJobTime, TimeUnit.MINUTES));


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)
> Moti, can you elaborate here?
Yair - in this point we just need a new transaction - the other JPA options are 
not relevant. It's a batch - always a new transaction that is not related to 
the rest of the transactions.
Concerning Moti's request - I'll make this method transactional once the Job 
JPA patch comes through
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 20:  */
Line 21: public class JobWrapper implements Job {
Line 22: 
Line 23:     // static data members
Line 24:     private static ConcurrentHashMap<String, Method> cachedMethods = 
new ConcurrentHashMap<String, Method>();
> Just a matter of style -
Done
Line 25:     private final Logger log = 
LoggerFactory.getLogger(SchedulerUtilQuartzImpl.class);
Line 26: 
Line 27:     /**
Line 28:      * execute a method within an instance. The instance and the 
method name are


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:
Done
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.:
Done
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

Reply via email to