syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacom...@apache.org
Subject syncope git commit: [SYNCOPE-719] Removed enduser cache service
Date Fri, 26 Feb 2016 10:56:10 GMT
Repository: syncope
Updated Branches:
  refs/heads/master e1b668a3f -> c22269170


[SYNCOPE-719] Removed enduser cache service


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c2226917
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c2226917
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c2226917

Branch: refs/heads/master
Commit: c2226917062427c11c6eac1719e33794db640557
Parents: e1b668a
Author: giacomolm <giacomolm@hotmail.it>
Authored: Fri Feb 26 11:55:43 2016 +0100
Committer: giacomolm <giacomolm@hotmail.it>
Committed: Fri Feb 26 11:55:43 2016 +0100

----------------------------------------------------------------------
 .../client/enduser/SyncopeEnduserSession.java   | 27 +++-----------------
 1 file changed, 4 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c2226917/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
index dfaf844..ed05718 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserSession.java
@@ -19,8 +19,6 @@
 package org.apache.syncope.client.enduser;
 
 import java.text.DateFormat;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -62,8 +60,6 @@ public class SyncopeEnduserSession extends WebSession {
 
     private UserTO selfTO;
 
-    private final Map<Class<?>, Object> services = Collections.synchronizedMap(new
HashMap<Class<?>, Object>());
-
     private final CookieUtils cookieUtils;
 
     private boolean xsrfTokenGenerated = false;
@@ -99,8 +95,6 @@ public class SyncopeEnduserSession extends WebSession {
             // for every  request
             this.bind();
             authenticated = true;
-            //we should clear all the previous services
-            services.clear();
         } catch (Exception e) {
             LOG.error("Authentication failed", e);
         }
@@ -109,30 +103,17 @@ public class SyncopeEnduserSession extends WebSession {
     }
 
     public <T> void resetClient(final Class<T> service) {
-        T serviceInstance = getCachedService(service);
+        T serviceInstance = getService(service);
         WebClient.client(serviceInstance).reset();
     }
 
-    @SuppressWarnings("unchecked")
-    private <T> T getCachedService(final Class<T> serviceClass) {
-        T service;
-        if (services.containsKey(serviceClass)) {
-            service = (T) services.get(serviceClass);
-        } else {
-            service = (client == null || !isAuthenticated()) ? anonymousClient.getService(serviceClass)
: client.
-                    getService(serviceClass);
-            services.put(serviceClass, service);
-        }
-
-        return service;
-    }
-
     public <T> T getService(final Class<T> serviceClass) {
-        return getCachedService(serviceClass);
+        return (client == null || !isAuthenticated()) ? anonymousClient.getService(serviceClass)
: client.
+                getService(serviceClass);
     }
 
     public <T> T getService(final String etag, final Class<T> serviceClass) {
-        T serviceInstance = getCachedService(serviceClass);
+        T serviceInstance = getService(serviceClass);
         WebClient.client(serviceInstance).match(new EntityTag(etag), false).
                 type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
 


Mime
View raw message