This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 783857b Construct credentials only once for ServerInfo (#2374) 783857b is described below commit 783857b35fd322e96b7a5737df3ac381b22c41bd Author: markjens <94677193+markj...@users.noreply.github.com> AuthorDate: Fri Dec 10 09:00:53 2021 +0200 Construct credentials only once for ServerInfo (#2374) In order to improve performance, construct the server credentials in ServerInfo from the provided site configuration, in order to cache it in the ServerInfo object, so it is not constructed multiple times. Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- .../base/src/main/java/org/apache/accumulo/server/ServerInfo.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java b/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java index 4427c99..2de8477 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java +++ b/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java @@ -54,6 +54,7 @@ public class ServerInfo implements ClientInfo { private final VolumeManager volumeManager; private final ZooCache zooCache; private final ServerDirs serverDirs; + private final Credentials credentials; ServerInfo(SiteConfiguration siteConfig, String instanceName, String zooKeepers, int zooKeepersSessionTimeOut) { @@ -84,6 +85,7 @@ public class ServerInfo implements ClientInfo { + instanceName + " does not exist in zookeeper"); } serverDirs = new ServerDirs(siteConfig, hadoopConf); + credentials = SystemCredentials.get(instanceID, siteConfig); } ServerInfo(SiteConfiguration config) { @@ -102,6 +104,7 @@ public class ServerInfo implements ClientInfo { zooKeepersSessionTimeOut = (int) config.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT); zooCache = new ZooCacheFactory().getZooCache(zooKeepers, zooKeepersSessionTimeOut); instanceName = InstanceOperationsImpl.lookupInstanceName(zooCache, UUID.fromString(instanceID)); + credentials = SystemCredentials.get(instanceID, siteConfig); } ServerInfo(SiteConfiguration config, String instanceName, String instanceID) { @@ -119,6 +122,7 @@ public class ServerInfo implements ClientInfo { zooCache = new ZooCacheFactory().getZooCache(zooKeepers, zooKeepersSessionTimeOut); this.instanceName = instanceName; serverDirs = new ServerDirs(siteConfig, hadoopConf); + credentials = SystemCredentials.get(instanceID, siteConfig); } public SiteConfiguration getSiteConfiguration() { @@ -176,7 +180,7 @@ public class ServerInfo implements ClientInfo { } public Credentials getCredentials() { - return SystemCredentials.get(getInstanceID(), getSiteConfiguration()); + return credentials; } @Override