Allon Mureinik has uploaded a new change for review.

Change subject: core: FB: Clean up JobWrapper's method cache
......................................................................

core: FB: Clean up JobWrapper's method cache

Cleaned up JobWrapper.execute()'s work with the method cache.

Since the statement "if (cachedMethods.containsKey(methodToRun))" always
evaluates to false the method cache was NEVER used. This patch enables
the use of the cache and solves the NP_LOAD_OF_KNOWN_NULL_VALUE error
detected by FindBugs.

Change-Id: I2e6e3ae5bba5f543f7dab11309c2f7dd8d67bc00
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M 
backend/manager/modules/beans/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java
1 file changed, 3 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/16/8416/1

diff --git 
a/backend/manager/modules/beans/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java
 
b/backend/manager/modules/beans/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java
index 7d893e2..d59445d 100644
--- 
a/backend/manager/modules/beans/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java
+++ 
b/backend/manager/modules/beans/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java
@@ -38,26 +38,22 @@
             Map paramsMap = data.getWrappedMap();
             methodName = (String) 
paramsMap.get(SchedulerUtilQuartzImpl.RUN_METHOD_NAME);
             Object instance = 
paramsMap.get(SchedulerUtilQuartzImpl.RUNNABLE_INSTANCE);
-            // Class[] methodParamsType =
-            // 
(Class[])paramsMap.get(SchedulerUtilQuartzImpl.RUN_METHOD_PARAM_TYPE);
             Object[] methodParams = (Object[]) 
paramsMap.get(SchedulerUtilQuartzImpl.RUN_METHOD_PARAM);
             String methodKey = getMethodKey(instance.getClass().getName(), 
methodName);
             Method methodToRun = cachedMethods.get(methodKey);
             if (methodToRun == null) {
                 synchronized (cachedMethods) {
-                    if (cachedMethods.containsKey(methodToRun)) {
+                    if (cachedMethods.containsKey(methodKey)) {
                         methodToRun = cachedMethods.get(methodKey);
                     } else {
-                        // methodToRun =
-                        // 
instance.getClass().getMethod(methodName,methodParamsType);
                         methodToRun = getMethodToRun(instance, methodName);
                         if (methodToRun == null) {
                             log.error("could not find the required method " + 
methodName + " on instance of "
                                     + instance.getClass().getSimpleName());
                             return;
-                        } else {
-                            cachedMethods.put(methodKey, methodToRun);
                         }
+
+                        cachedMethods.put(methodKey, methodToRun);
                     }
                 }
             }


--
To view, visit http://gerrit.ovirt.org/8416
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e6e3ae5bba5f543f7dab11309c2f7dd8d67bc00
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to