Michael Kublin has uploaded a new change for review.

Change subject: engine: TmeoutBase - Improving memory footprint - continue
......................................................................

engine: TmeoutBase - Improving memory footprint - continue

After changes inside TimeoutBase, I found out that the cache is used only as 
place holder,
so instead of putting TimeouBase object to cache I decided to put String, also 
possible to put
some king const Object but, I think it is not make any difference
Benefit - String should take less memory than TimeoutBase will all loaded 
objects from DB

Change-Id: I795019a35a57fef688296d9f1083bc77c9272bc7
Signed-off-by: Michael Kublin <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
2 files changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/14158/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
index 3dfe67d..1cab0e7 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
@@ -47,13 +47,12 @@
      * Checks if timeout is used and if it is, checks the timeout. If no 
timeout set, then it will set this object as timeout.
      * @return should the action be logged again
      */
-    @SuppressWarnings("unchecked")
     public boolean getLegal() {
         if (getUseTimout()) {
             String keyForCheck = getkeyForCheck();
             if (CacheManager.getTimeoutBaseCache().putIfAbsent(keyForCheck,
-                    this,
-                    this.getEndTime(),
+                    keyForCheck,
+                    getEndTime(),
                     TimeUnit.MILLISECONDS) == null) {
                 return true;
             }
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
index 11a83ff..2423b50 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/cache/CacheManager.java
@@ -6,10 +6,9 @@
 import org.ovirt.engine.core.utils.ejb.BeanType;
 import org.ovirt.engine.core.utils.ejb.EjbUtils;
 
-@SuppressWarnings("rawtypes")
 public class CacheManager {
 
-    public static Cache getTimeoutBaseCache() {
+    public static Cache<String, String> getTimeoutBaseCache() {
         CacheContainer cacheContainer = 
EjbUtils.findBean(BeanType.CACHE_CONTAINER, BeanProxyType.LOCAL);
         return cacheContainer.getCache("timeout-base");
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I795019a35a57fef688296d9f1083bc77c9272bc7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Michael Kublin <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to