Kobi Ianko has uploaded a new change for review.

Change subject: core: Fix AuditLog check for existing log entries
......................................................................

core: Fix AuditLog check for existing log entries

The audit log check for existing element in the cache,
If the entry exist, then there is no need for another log message.
This is how the anti flooding mechanism works.
For that we use Infinispan cache and the putIfAbsent method,
which updates the lifespan(time to keep in cache).
For our use of the cache, we don't want this update.

The fix changes the putIfAbsent and replace it with two othe API methods,
Contains and Put.

Change-Id: I94b777911eb1ff667be3dc8362bde5746d84824c
Bug-Url: https://bugzilla.redhat.com/1079920
Signed-off-by: Kobi Ianko <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/TimeoutBase.java
1 file changed, 2 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/26028/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 a7343e9..9a94fe6 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
@@ -48,10 +48,8 @@
     public boolean getLegal() {
         if (getUseTimout()) {
             String keyForCheck = getkeyForCheck();
-            if (CacheManager.getTimeoutBaseCache().putIfAbsent(keyForCheck,
-                    keyForCheck,
-                    getEndTime(),
-                    TimeUnit.MILLISECONDS) == null) {
+            if (!CacheManager.getTimeoutBaseCache().containsKey(keyForCheck)) {
+                CacheManager.getTimeoutBaseCache().put(keyForCheck, 
keyForCheck, getEndTime(), TimeUnit.MILLISECONDS);
                 return true;
             }
             return false;


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

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

Reply via email to