james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [7/7] james-project git commit: JAMES-2446 Avoid reading several time Keyspace metadata
Date Tue, 03 Jul 2018 08:51:45 GMT
JAMES-2446 Avoid reading several time Keyspace metadata


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

Branch: refs/heads/master
Commit: b7e2dae16899d4959f37966fd0e5ca33f9687353
Parents: 9ac970d
Author: benwa <btellier@linagora.com>
Authored: Fri Jun 29 17:50:15 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Jul 3 15:50:45 2018 +0700

----------------------------------------------------------------------
 .../cassandra/init/CassandraTypesProvider.java        | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b7e2dae1/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
index 356c7ac..3600f0d 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import org.apache.james.backends.cassandra.components.CassandraModule;
 import org.apache.james.backends.cassandra.components.CassandraType;
 
+import com.datastax.driver.core.KeyspaceMetadata;
 import com.datastax.driver.core.Session;
 import com.datastax.driver.core.UserType;
 import com.github.steveash.guavate.Guavate;
@@ -36,18 +37,15 @@ public class CassandraTypesProvider {
 
     @Inject
     public CassandraTypesProvider(CassandraModule module, Session session) {
+        KeyspaceMetadata keyspaceMetadata = session.getCluster()
+            .getMetadata()
+            .getKeyspace(session.getLoggedKeyspace());
+
         userTypes = module.moduleTypes()
             .stream()
             .collect(Guavate.toImmutableMap(
                     CassandraType::getName,
-                    type -> getSessionType(session, type)));
-    }
-
-    private UserType getSessionType(Session session, CassandraType type) {
-        return session.getCluster()
-            .getMetadata()
-            .getKeyspace(session.getLoggedKeyspace())
-            .getUserType(type.getName());
+                    type -> keyspaceMetadata.getUserType(type.getName())));
     }
 
     public UserType getDefinedUserType(String typeName) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message