1 /***********************************************************************
2  * Copyright (c) 2013-2024 Commonwealth Computer Research, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Apache License, Version 2.0
5  * which accompanies this distribution and is available at
6  * http://www.opensource.org/licenses/apache2.0.php.
7  ***********************************************************************/
8 
9 package org.locationtech.geomesa.hbase.data
10 
11 import com.github.benmanes.caffeine.cache.{CacheLoader, Caffeine, LoadingCache}
12 import com.typesafe.scalalogging.LazyLogging
13 import org.apache.hadoop.conf.Configuration
14 import org.apache.hadoop.hbase.client.{Connection, ConnectionFactory}
15 import org.apache.hadoop.hbase.security.User
16 import org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier
17 import org.apache.hadoop.hbase.{HBaseConfiguration, HConstants}
18 import org.apache.hadoop.security.authentication.util.KerberosUtil
19 import org.apache.hadoop.security.{SecurityUtil, UserGroupInformation}
20 import org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.{HBaseGeoMesaKeyTab, HBaseGeoMesaPrincipal}
21 import org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.{ConfigPathsParam, ConfigsParam, ConnectionParam, ZookeeperParam}
22 import org.locationtech.geomesa.hbase.utils.HBaseVersions
23 import org.locationtech.geomesa.utils.hadoop.HadoopUtils
24 import org.locationtech.geomesa.utils.io.CloseWithLogging
25 
26 import java.io.{ByteArrayInputStream, Closeable}
27 import java.nio.charset.StandardCharsets
28 import java.security.PrivilegedExceptionAction
29 import scala.util.{Failure, Success, Try}
30 
31 object HBaseConnectionPool extends LazyLogging {
32 
33   import scala.collection.JavaConverters._
34 
35   private val configs: LoadingCache[ConfigKey, Configuration] = Caffeine.newBuilder().build(
36     new CacheLoader[ConfigKey, Configuration] {
37 
38       // add common resources from system property - lazy to allow object initialization if there's an error
39       private lazy val configuration = {
40         val base = HBaseConfiguration.create()
41         HBaseDataStoreFactory.ConfigPathProperty.option.foreach(addResources(base, _))
42         base
43       }
44 
45       override def load(key: ConfigKey): Configuration = {
46         val conf = new Configuration(configuration)
47         // Make sure that current user is always logged-in user
48         conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider")
49         // add the explicit props first, they may be needed for loading the path resources
50         key.xml.foreach(xml => conf.addResource(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))))
51         key.paths.foreach(addResources(conf, _))
52         key.zookeepers.foreach(zk => conf.set(HConstants.ZOOKEEPER_QUORUM, zk))
53         if (key.zookeepers.isEmpty && conf.get(HConstants.ZOOKEEPER_QUORUM) == "localhost") {
54           logger.warn("HBase connection is set to localhost - " +
55               "this may indicate that 'hbase-site.xml' is not on the classpath")
56         }
57         conf
58       }
59 
60       private def addResources(conf: Configuration, paths: String): Unit =
61         paths.split(',').map(_.trim).filterNot(_.isEmpty).foreach(HadoopUtils.addResource(conf, _))
62     }
63   )
64 
65   private val connections: LoadingCache[(Configuration, Boolean), CachedConnection] =  Caffeine.newBuilder().build(
66     new CacheLoader[(Configuration, Boolean), CachedConnection] {
67       override def load(key: (Configuration, Boolean)): CachedConnection = {
68         createConnection(key._1, key._2) match {
69           case SingletonConnection(connection, kerberos) => CachedConnection(connection, kerberos)
70           case c => throw new NotImplementedError(s"Expected SingletonConnection but got $c")
71         }
72       }
73     }
74   )
75 
76   Runtime.getRuntime.addShutdownHook(new Thread() {
77     override def run(): Unit =
78       CloseWithLogging(connections.asMap().values().asScala.flatMap { case CachedConnection(c, k) => Seq(c) ++ k })
79   })
80 
81   /**
82    * Get (or create) a cached configuration
83    *
84    * @param params data store params
85    * @return
86    */
87   def getConfiguration(params: java.util.Map[String, _]): Configuration = {
88     val zk = ZookeeperParam.lookupOpt(params)
89     val paths = ConfigPathsParam.lookupOpt(params)
90     val xml = ConfigsParam.lookupOpt(params)
91     configs.get(ConfigKey(zk, paths, xml))
92   }
93 
94   /**
95    * Get (or create) a cached connection
96    *
97    * @param params data store params
98    * @param validate validate the connection after creation, or not
99    * @return
100    */
101   def getConnection(params: java.util.Map[String, _], validate: Boolean): ConnectionWrapper = {
102     if (ConnectionParam.exists(params)) {
103       ProvidedConnection(ConnectionParam.lookup(params))
104     } else {
105       val conf = getConfiguration(params)
106       logger.debug(s"Connecting to HBase instance at ${conf.get(HConstants.ZOOKEEPER_QUORUM)}")
107       if (HBaseDataStoreParams.CacheConnectionsParam.lookup(params)) {
108         connections.get((conf, validate))
109       } else {
110         createConnection(conf, validate)
111       }
112     }
113   }
114 
115   /**
116    * Create a new connection (not pooled)
117    *
118    * @param conf hbase configuration
119    * @param validate validate the connection after creation, or not
120    * @return
121    */
122   def createConnection(conf: Configuration, validate: Boolean): ConnectionWrapper = {
123     if (User.isHBaseSecurityEnabled(conf)) {
124       configureSecurity(conf)
125       val action = new PrivilegedExceptionAction[ConnectionWrapper]() {
126         override def run(): ConnectionWrapper = doCreateConnection(conf, validate)
127       }
128       val user = UserGroupInformation.getLoginUser
129       logger.info(s"Creating Secured HBase connection with user $user")
130       user.doAs(action)
131     } else {
132       logger.info(s"Creating unsecured HBase connection")
133       doCreateConnection(conf, validate)
134     }
135   }
136 
137   private def doCreateConnection(conf: Configuration, validate: Boolean): ConnectionWrapper = {
138     if (validate) {
139       logger.debug("Checking configuration availability")
140       HBaseVersions.checkAvailable(conf)
141     }
142     val connection = ConnectionFactory.createConnection(conf)
143     val kerberos = if (User.isHBaseSecurityEnabled(conf)) { Some(HadoopUtils.kerberosTicketRenewer()) } else { None }
144     SingletonConnection(connection, kerberos)
145   }
146 
147   /**
148    * Configures hadoop security, based on the configuration.
149    *
150    * Note: hadoop security is configured globally - having different security settings in a single JVM
151    * will likely result in errors
152    *
153    * @param conf conf
154    */
155   def configureSecurity(conf: Configuration): Unit = synchronized {
156     import AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE
157 
158     if (User.isHBaseSecurityEnabled(conf)) {
159       val currentUser = UserGroupInformation.getLoginUser
160       if (currentUser.getCredentials.getAllTokens.asScala.exists(_.getKind == AUTH_TOKEN_TYPE)) {
161         logger.debug("Using existing HBase authentication token")
162       } else {
163         val keytab = conf.get(HBaseGeoMesaKeyTab)
164         val rawPrincipal = conf.get(HBaseGeoMesaPrincipal)
165 
166         if (keytab == null || rawPrincipal == null) {
167           lazy val missing =
168             Seq(HBaseGeoMesaKeyTab -> keytab, HBaseGeoMesaPrincipal -> rawPrincipal).collect { case (k, null) => k }
169           logger.warn(s"Security is enabled but missing credentials under '${missing.mkString("' and '")}'")
170         } else {
171           val principal = fullPrincipal(rawPrincipal)
172 
173           lazy val principalMsg =
174             s"'$principal'${if (principal == rawPrincipal) { "" } else { s" (original '$rawPrincipal')"}}"
175           logger.debug(
176             s"Using Kerberos with principal $principalMsg, keytab '$keytab', " +
177                 s"and Hadoop authentication method '${SecurityUtil.getAuthenticationMethod(conf)}'")
178 
179           if (currentUser.hasKerberosCredentials && currentUser.getUserName == principal) {
180             logger.debug(s"User '$principal' is already authenticated")
181           } else {
182             if (currentUser.hasKerberosCredentials) {
183               logger.warn(
184                 s"Changing global authenticated Hadoop user from '${currentUser.getUserName}' to '$principal' -" +
185                     "this will affect any connections still using the old user")
186             }
187             UserGroupInformation.setConfiguration(conf)
188             UserGroupInformation.loginUserFromKeytab(principal, keytab)
189 
190             logger.debug(s"Logged into Hadoop with user '${UserGroupInformation.getLoginUser.getUserName}'")
191           }
192         }
193       }
194     }
195   }
196 
197   /**
198    * Replace _HOST with the current host and add the default realm if nothing is specified.
199    *
200    * `SecurityUtil.getServerPrincipal` will replace the _HOST but only if there is already a realm.
201    *
202    * @param principal kerberos principal
203    * @return
204    */
205   private def fullPrincipal(principal: String): String = {
206     if (principal.indexOf('@') != -1) {
207       // we have a realm so this should be work to replace _HOST if present
208       SecurityUtil.getServerPrincipal(principal, null: String)
209     } else {
210       // try to add the default realm and replace _HOST if present
211       Try(KerberosUtil.getDefaultRealm) match {
212         case Success(realm) => SecurityUtil.getServerPrincipal(s"$principal@$realm", null: String)
213         case Failure(e) =>
214           logger.warn(s"Unable to get default Kerberos realm: $e")
215           if (!principal.contains(SecurityUtil.HOSTNAME_PATTERN)) { principal } else {
216             // append a fake realm so that the _HOST replacement works and then remove it afterwards
217             SecurityUtil.getServerPrincipal(s"$principal@foo", null: String).dropRight(4)
218           }
219       }
220     }
221   }
222 
223   /**
224    * Managed connection. The connection itself should not be closed - instead close the wrapper to handle
225    * lifecycle events appropriately.
226    */
227   sealed trait ConnectionWrapper extends Closeable {
228     val connection: Connection
229   }
230 
231   /**
232    * An unshared connection
233    *
234    * @param connection connection
235    * @param kerberos kerberos ticket renewal thread
236    */
237   case class SingletonConnection(connection: Connection, kerberos: Option[Closeable]) extends ConnectionWrapper {
238     override def close(): Unit = CloseWithLogging(kerberos.toSeq ++ Seq(connection))
239   }
240 
241   /**
242    * A shared, cached connection
243    *
244    * @param connection connection
245    * @param kerberos kerberos ticket renewal thread
246    */
247   case class CachedConnection(connection: Connection, kerberos: Option[Closeable]) extends ConnectionWrapper {
248     override def close(): Unit = {}
249   }
250 
251   /**
252    * Provided connection - no lifecycle management is performed
253    *
254    * @param connection connection
255    */
256   case class ProvidedConnection(connection: Connection) extends ConnectionWrapper {
257     override def close(): Unit = {}
258   }
259 
260   private case class ConfigKey(zookeepers: Option[String], paths: Option[String], xml: Option[String])
261 }
Line Stmt Id Pos Tree Symbol Tests Code
35 89202 1823 - 3281 Apply com.github.benmanes.caffeine.cache.Caffeine.build com.github.benmanes.caffeine.cache.Caffeine.newBuilder().build[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey, org.apache.hadoop.conf.Configuration]({ final class $anon extends Object with com.github.benmanes.caffeine.cache.CacheLoader[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey,org.apache.hadoop.conf.Configuration] { def <init>(): <$anon: com.github.benmanes.caffeine.cache.CacheLoader[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey,org.apache.hadoop.conf.Configuration]> = { $anon.super.<init>(); () }; <stable> <accessor> lazy private val configuration: org.apache.hadoop.conf.Configuration = { val base: org.apache.hadoop.conf.Configuration = org.apache.hadoop.hbase.HBaseConfiguration.create(); HBaseDataStoreFactory.ConfigPathProperty.option.foreach[Unit](((x$1: String) => $anon.this.addResources(base, x$1))); base }; override def load(key: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey): org.apache.hadoop.conf.Configuration = { val conf: org.apache.hadoop.conf.Configuration = new org.apache.hadoop.conf.Configuration($anon.this.configuration); conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider"); key.xml.foreach[Unit](((xml: String) => conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8))))); key.paths.foreach[Unit](((x$2: String) => $anon.this.addResources(conf, x$2))); key.zookeepers.foreach[Unit](((zk: String) => conf.set("hbase.zookeeper.quorum", zk))); if (key.zookeepers.isEmpty.&&(conf.get("hbase.zookeeper.quorum").==("localhost"))) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("HBase connection is set to localhost - this may indicate that \'hbase-site.xml\' is not on the classpath") else (): Unit) else (); conf }; private def addResources(conf: org.apache.hadoop.conf.Configuration, paths: String): Unit = scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))).foreach[Unit](((x$5: String) => org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5))) }; new $anon() })
36 89201 1856 - 1859 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
46 89177 2285 - 2317 Apply org.apache.hadoop.conf.Configuration.<init> new org.apache.hadoop.conf.Configuration($anon.this.configuration)
48 89178 2390 - 2490 Apply org.apache.hadoop.conf.Configuration.set conf.set("hbase.client.userprovider.class", "org.locationtech.geomesa.hbase.data.LoginUserProvider")
50 89179 2668 - 2690 Select java.nio.charset.StandardCharsets.UTF_8 java.nio.charset.StandardCharsets.UTF_8
50 89181 2630 - 2692 Apply java.io.ByteArrayInputStream.<init> new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8))
50 89180 2655 - 2691 Apply java.lang.String.getBytes xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)
50 89183 2590 - 2694 Apply scala.Option.foreach key.xml.foreach[Unit](((xml: String) => conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)))))
50 89182 2613 - 2693 Apply org.apache.hadoop.conf.Configuration.addResource conf.addResource(new java.io.ByteArrayInputStream(xml.getBytes(java.nio.charset.StandardCharsets.UTF_8)))
51 89185 2703 - 2743 Apply scala.Option.foreach key.paths.foreach[Unit](((x$2: String) => $anon.this.addResources(conf, x$2)))
51 89184 2721 - 2742 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.addResources $anon.this.addResources(conf, x$2)
52 89187 2752 - 2823 Apply scala.Option.foreach key.zookeepers.foreach[Unit](((zk: String) => conf.set("hbase.zookeeper.quorum", zk)))
52 89186 2781 - 2822 Apply org.apache.hadoop.conf.Configuration.set conf.set("hbase.zookeeper.quorum", zk)
53 89189 2836 - 2914 Apply scala.Boolean.&& key.zookeepers.isEmpty.&&(conf.get("hbase.zookeeper.quorum").==("localhost"))
53 89188 2862 - 2914 Apply java.lang.Object.== conf.get("hbase.zookeeper.quorum").==("localhost")
53 89191 2832 - 2832 Literal <nosymbol> ()
53 89192 2832 - 2832 Block <nosymbol> ()
54 89190 2928 - 3064 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("HBase connection is set to localhost - this may indicate that \'hbase-site.xml\' is not on the classpath") else (): Unit)
61 89193 3180 - 3196 Apply scala.collection.immutable.StringLike.split scala.Predef.augmentString(paths).split(',')
61 89195 3200 - 3200 ApplyToImplicitArgs scala.Array.canBuildFrom scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String]))
61 89194 3201 - 3207 Apply java.lang.String.trim x$3.trim()
61 89197 3219 - 3228 Apply java.lang.String.isEmpty x$4.isEmpty()
61 89196 3180 - 3208 ApplyToImplicitArgs scala.collection.TraversableLike.map scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))
61 89199 3238 - 3270 Apply org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5)
61 89198 3180 - 3229 Apply scala.collection.TraversableLike.filterNot scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))
61 89200 3180 - 3271 Apply scala.collection.IndexedSeqOptimized.foreach scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.refArrayOps[String](scala.Predef.augmentString(paths).split(',')).map[String, Array[String]](((x$3: String) => x$3.trim()))(scala.this.Array.canBuildFrom[String]((ClassTag.apply[String](classOf[java.lang.String]): scala.reflect.ClassTag[String])))).filterNot(((x$4: String) => x$4.isEmpty()))).foreach[Unit](((x$5: String) => org.locationtech.geomesa.utils.hadoop.HadoopUtils.addResource(conf, x$5)))
65 89211 3370 - 3811 Apply com.github.benmanes.caffeine.cache.Caffeine.build com.github.benmanes.caffeine.cache.Caffeine.newBuilder().build[(org.apache.hadoop.conf.Configuration, Boolean), org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection]({ final class $anon extends Object with com.github.benmanes.caffeine.cache.CacheLoader[(org.apache.hadoop.conf.Configuration, Boolean),org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection] { def <init>(): <$anon: com.github.benmanes.caffeine.cache.CacheLoader[(org.apache.hadoop.conf.Configuration, Boolean),org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection]> = { $anon.super.<init>(); () }; override def load(key: (org.apache.hadoop.conf.Configuration, Boolean)): org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection = HBaseConnectionPool.this.createConnection(key._1, key._2) match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection((connection @ _), (kerberos @ _)) => HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos) case (c @ _) => throw new scala.NotImplementedError(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c)) } }; new $anon() })
66 89210 3403 - 3406 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
68 89203 3567 - 3573 Select scala.Tuple2._1 key._1
68 89205 3550 - 3582 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(key._1, key._2)
68 89204 3575 - 3581 Select scala.Tuple2._2 key._2
69 89207 3651 - 3689 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection.apply HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos)
69 89206 3651 - 3689 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection.apply HBaseConnectionPool.this.CachedConnection.apply(connection, kerberos)
70 89209 3710 - 3783 Block <nosymbol> throw new scala.NotImplementedError(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c))
70 89208 3710 - 3783 Throw <nosymbol> throw new scala.NotImplementedError(scala.StringContext.apply("Expected SingletonConnection but got ", "").s(c))
76 89223 3815 - 4016 Apply java.lang.Runtime.addShutdownHook java.lang.Runtime.getRuntime().addShutdownHook({ final class $anon extends java.lang.Thread { def <init>(): <$anon: Thread> = { $anon.super.<init>(); () }; override def run(): Unit = { org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Iterable[java.io.Closeable]](scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable); () } }; new $anon() })
76 89222 3850 - 3853 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
78 89213 4007 - 4008 ApplyImplicitView scala.Option.option2Iterable scala.this.Option.option2Iterable[java.io.Closeable](k)
78 89212 3919 - 3947 Apply java.util.Map.values HBaseConnectionPool.this.connections.asMap().values()
78 89215 3997 - 4008 ApplyToImplicitArgs scala.collection.TraversableLike.++ scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable])
78 89214 4004 - 4004 TypeApply scala.collection.Seq.canBuildFrom collection.this.Seq.canBuildFrom[java.io.Closeable]
78 89217 3964 - 3964 TypeApply scala.collection.Iterable.canBuildFrom collection.this.Iterable.canBuildFrom[java.io.Closeable]
78 89216 3997 - 4008 Block scala.collection.TraversableLike.++ scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable])
78 89219 3918 - 3918 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.iterableIsCloseable io.this.IsCloseable.iterableIsCloseable
78 89218 3919 - 4010 ApplyToImplicitArgs scala.collection.TraversableLike.flatMap scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable])
78 89221 3918 - 3918 Literal <nosymbol> ()
78 89220 3902 - 4011 ApplyToImplicitArgs org.locationtech.geomesa.utils.io.CloseWithLogging.apply org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Iterable[java.io.Closeable]](scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection](HBaseConnectionPool.this.connections.asMap().values()).asScala.flatMap[java.io.Closeable, Iterable[java.io.Closeable]](((x0$1: org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection) => x0$1 match { case (connection: org.apache.hadoop.hbase.client.Connection, kerberos: Option[java.io.Closeable])org.locationtech.geomesa.hbase.data.HBaseConnectionPool.CachedConnection((c @ _), (k @ _)) => scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](c).++[java.io.Closeable, Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](k))(collection.this.Seq.canBuildFrom[java.io.Closeable]) }))(collection.this.Iterable.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable)
88 89224 4218 - 4250 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ZookeeperParam.lookupOpt(params)
89 89225 4267 - 4301 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConfigPathsParam.lookupOpt(params)
90 89226 4316 - 4346 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookupOpt org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConfigsParam.lookupOpt(params)
91 89227 4363 - 4388 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConfigKey.apply HBaseConnectionPool.this.ConfigKey.apply(zk, paths, xml)
91 89228 4351 - 4389 Apply com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.configs.get(HBaseConnectionPool.this.ConfigKey.apply(zk, paths, xml))
102 89229 4675 - 4705 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.exists org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.exists(params)
103 89231 4715 - 4765 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ProvidedConnection.apply HBaseConnectionPool.this.ProvidedConnection.apply(org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params))
103 89230 4734 - 4764 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookup org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params)
103 89232 4715 - 4765 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ProvidedConnection.apply HBaseConnectionPool.this.ProvidedConnection.apply(org.locationtech.geomesa.hbase.data.HBaseDataStoreParams.ConnectionParam.lookup(params))
104 89241 4777 - 5099 Block <nosymbol> { val conf: org.apache.hadoop.conf.Configuration = HBaseConnectionPool.this.getConfiguration(params); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Connecting to HBase instance at {}", (conf.get("hbase.zookeeper.quorum"): AnyRef)) else (): Unit); if (scala.Predef.Boolean2boolean(HBaseDataStoreParams.CacheConnectionsParam.lookup(params))) HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate)) else HBaseConnectionPool.this.createConnection(conf, validate) }
105 89233 4796 - 4820 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.getConfiguration HBaseConnectionPool.this.getConfiguration(params)
107 89235 4927 - 4984 ApplyImplicitView scala.Predef.Boolean2boolean scala.Predef.Boolean2boolean(HBaseDataStoreParams.CacheConnectionsParam.lookup(params))
107 89234 4927 - 4984 Apply org.locationtech.geomesa.utils.geotools.GeoMesaParam.lookup HBaseDataStoreParams.CacheConnectionsParam.lookup(params)
108 89237 4996 - 5029 Apply com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate))
108 89236 5012 - 5028 Apply scala.Tuple2.apply scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate)
108 89238 4996 - 5029 Block com.github.benmanes.caffeine.cache.LoadingCache.get HBaseConnectionPool.this.connections.get(scala.Tuple2.apply[org.apache.hadoop.conf.Configuration, Boolean](conf, validate))
110 89239 5053 - 5085 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(conf, validate)
110 89240 5053 - 5085 Block org.locationtech.geomesa.hbase.data.HBaseConnectionPool.createConnection HBaseConnectionPool.this.createConnection(conf, validate)
123 89242 5376 - 5409 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
123 89248 5411 - 5758 Block <nosymbol> { HBaseConnectionPool.this.configureSecurity(conf); val action: java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper] = { final class $anon extends Object with java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper] { def <init>(): <$anon: java.security.PrivilegedExceptionAction[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper]> = { $anon.super.<init>(); () }; override def run(): org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper = HBaseConnectionPool.this.doCreateConnection(conf, validate) }; new $anon() }; val user: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); (if (HBaseConnectionPool.this.logger.underlying.isInfoEnabled()) HBaseConnectionPool.this.logger.underlying.info("Creating Secured HBase connection with user {}", (user: AnyRef)) else (): Unit); user.doAs[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper](action) }
124 89243 5419 - 5442 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.configureSecurity HBaseConnectionPool.this.configureSecurity(conf)
125 89245 5462 - 5465 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.$anon.<init> new $anon()
126 89244 5563 - 5597 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.doCreateConnection HBaseConnectionPool.this.doCreateConnection(conf, validate)
128 89246 5623 - 5656 Apply org.apache.hadoop.security.UserGroupInformation.getLoginUser org.apache.hadoop.security.UserGroupInformation.getLoginUser()
130 89247 5735 - 5752 Apply org.apache.hadoop.security.UserGroupInformation.doAs user.doAs[org.locationtech.geomesa.hbase.data.HBaseConnectionPool.ConnectionWrapper](action)
131 89250 5764 - 5870 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isInfoEnabled()) HBaseConnectionPool.this.logger.underlying.info("Creating unsecured HBase connection") else (): Unit); HBaseConnectionPool.this.doCreateConnection(conf, validate) }
133 89249 5830 - 5864 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.doCreateConnection HBaseConnectionPool.this.doCreateConnection(conf, validate)
138 89253 5976 - 5976 Literal <nosymbol> ()
138 89252 5990 - 6096 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Checking configuration availability") else (): Unit); org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable(conf) }
138 89254 5976 - 5976 Block <nosymbol> ()
140 89251 6056 - 6090 Apply org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable org.locationtech.geomesa.hbase.utils.HBaseVersions.checkAvailable(conf)
142 89255 6118 - 6158 Apply org.apache.hadoop.hbase.client.ConnectionFactory.createConnection org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(conf)
143 89257 6224 - 6259 Apply org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer()
143 89256 6182 - 6215 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
143 89259 6219 - 6260 Block scala.Some.apply scala.Some.apply[java.io.Closeable](org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer())
143 89258 6219 - 6260 Apply scala.Some.apply scala.Some.apply[java.io.Closeable](org.locationtech.geomesa.utils.hadoop.HadoopUtils.kerberosTicketRenewer())
143 89261 6270 - 6274 Block scala.None scala.None
143 89260 6270 - 6274 Select scala.None scala.None
144 89262 6281 - 6322 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.apply HBaseConnectionPool.this.SingletonConnection.apply(connection, kerberos)
155 89294 6623 - 8568 Apply java.lang.Object.synchronized HBaseConnectionPool.this.synchronized[Unit]({ import org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE; if (org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)) { val currentUser: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); if (scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit) else { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } } } else () })
158 89263 6704 - 6737 Apply org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled org.apache.hadoop.hbase.security.User.isHBaseSecurityEnabled(conf)
158 89291 6739 - 8564 Block <nosymbol> { val currentUser: org.apache.hadoop.security.UserGroupInformation = org.apache.hadoop.security.UserGroupInformation.getLoginUser(); if (scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit) else { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } } }
158 89293 6700 - 6700 Block <nosymbol> ()
158 89292 6700 - 6700 Literal <nosymbol> ()
159 89264 6765 - 6798 Apply org.apache.hadoop.security.UserGroupInformation.getLoginUser org.apache.hadoop.security.UserGroupInformation.getLoginUser()
160 89265 6809 - 6848 Apply org.apache.hadoop.security.Credentials.getAllTokens currentUser.getCredentials().getAllTokens()
160 89267 6864 - 6892 Apply java.lang.Object.== x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)
160 89266 6877 - 6892 Select org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE
160 89268 6809 - 6893 Apply scala.collection.IterableLike.exists scala.collection.JavaConverters.collectionAsScalaIterableConverter[org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]](currentUser.getCredentials().getAllTokens()).asScala.exists(((x$6: org.apache.hadoop.security.token.Token[_ <: org.apache.hadoop.security.token.TokenIdentifier]) => x$6.getKind().==(org.apache.hadoop.hbase.security.token.AuthenticationTokenIdentifier.AUTH_TOKEN_TYPE)))
161 89269 6905 - 6962 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Using existing HBase authentication token") else (): Unit)
162 89290 6976 - 8558 Block <nosymbol> { val keytab: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab); val rawPrincipal: String = conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal); if (keytab.==(null).||(rawPrincipal.==(null))) { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) } else { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } } }
163 89271 6999 - 7027 Apply org.apache.hadoop.conf.Configuration.get conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab)
163 89270 7008 - 7026 Select org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab
164 89273 7055 - 7086 Apply org.apache.hadoop.conf.Configuration.get conf.get(org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal)
164 89272 7064 - 7085 Select org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal
166 89275 7118 - 7138 Apply java.lang.Object.== rawPrincipal.==(null)
166 89274 7110 - 7114 Literal <nosymbol> null
166 89277 7140 - 7406 Block <nosymbol> { <stable> <accessor> lazy val missing: Seq[String] = scala.collection.Seq.apply[(String, String)](scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaKeyTab).->[String](keytab), scala.Predef.ArrowAssoc[String](org.locationtech.geomesa.hbase.data.HBaseDataStoreFactory.HBaseGeoMesaPrincipal).->[String](rawPrincipal)).collect[String, Seq[String]](({ @SerialVersionUID(value = 0) final <synthetic> class $anonfun extends scala.runtime.AbstractPartialFunction[(String, String),String] with Serializable { def <init>(): <$anon: ((String, String)) => String> = { $anonfun.super.<init>(); () }; final override def applyOrElse[A1 <: (String, String), B1 >: String](x1: A1, default: A1 => B1): B1 = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => k case (defaultCase$ @ _) => default.apply(x1) }; final def isDefinedAt(x1: (String, String)): Boolean = ((x1.asInstanceOf[(String, String)]: (String, String)): (String, String) @unchecked) match { case (_1: String, _2: String)(String, String)((k @ _), null) => true case (defaultCase$ @ _) => false } }; new $anonfun() }: PartialFunction[(String, String),String]))(collection.this.Seq.canBuildFrom[String]); (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Security is enabled but missing credentials under \'{}\'", (missing.mkString("\' and \'"): AnyRef)) else (): Unit) }
166 89276 7100 - 7138 Apply scala.Boolean.|| keytab.==(null).||(rawPrincipal.==(null))
170 89289 7412 - 8550 Block <nosymbol> { val principal: String = HBaseConnectionPool.this.fullPrincipal(rawPrincipal); <stable> <accessor> lazy val principalMsg: String = scala.StringContext.apply("\'", "\'", "").s(principal, if (principal.==(rawPrincipal)) "" else scala.StringContext.apply(" (original \'", "\')").s(rawPrincipal)); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug(scala.StringContext.apply("Using Kerberos with principal ", ", keytab \'", "\', ").s(principalMsg, keytab).+(scala.StringContext.apply("and Hadoop authentication method \'", "\'").s(org.apache.hadoop.security.SecurityUtil.getAuthenticationMethod(conf)))) else (): Unit); if (currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))) (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit) else { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) } }
171 89278 7440 - 7467 Apply org.locationtech.geomesa.hbase.data.HBaseConnectionPool.fullPrincipal HBaseConnectionPool.this.fullPrincipal(rawPrincipal)
179 89279 7869 - 7905 Apply java.lang.Object.== currentUser.getUserName().==(principal)
179 89280 7831 - 7905 Apply scala.Boolean.&& currentUser.hasKerberosCredentials().&&(currentUser.getUserName().==(principal))
180 89281 7921 - 7980 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("User \'{}\' is already authenticated", (principal: AnyRef)) else (): Unit)
181 89288 7998 - 8540 Block <nosymbol> { if (currentUser.hasKerberosCredentials()) (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit) else (); org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf); org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab); (if (HBaseConnectionPool.this.logger.underlying.isDebugEnabled()) HBaseConnectionPool.this.logger.underlying.debug("Logged into Hadoop with user \'{}\'", (org.apache.hadoop.security.UserGroupInformation.getLoginUser().getUserName(): AnyRef)) else (): Unit) }
182 89282 8016 - 8050 Apply org.apache.hadoop.security.UserGroupInformation.hasKerberosCredentials currentUser.hasKerberosCredentials()
182 89285 8012 - 8012 Block <nosymbol> ()
182 89284 8012 - 8012 Literal <nosymbol> ()
183 89283 8068 - 8276 Typed <nosymbol> (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn(scala.StringContext.apply("Changing global authenticated Hadoop user from \'", "\' to \'", "\' -").s(currentUser.getUserName(), principal).+("this will affect any connections still using the old user")) else (): Unit)
187 89286 8303 - 8346 Apply org.apache.hadoop.security.UserGroupInformation.setConfiguration org.apache.hadoop.security.UserGroupInformation.setConfiguration(conf)
188 89287 8359 - 8418 Apply org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(principal, keytab)
206 89295 8905 - 8933 Apply scala.Int.!= principal.indexOf(64).!=(-1)
208 89297 9019 - 9075 Apply org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(principal, (null: String))
208 89296 9062 - 9066 Literal <nosymbol> null
208 89298 9019 - 9075 Block org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(principal, (null: String))
211 89299 9166 - 9194 Apply org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm()
211 89300 9162 - 9195 Apply scala.util.Try.apply scala.util.Try.apply[String](org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm())
211 89311 9162 - 9694 Match <nosymbol> scala.util.Try.apply[String](org.apache.hadoop.security.authentication.util.KerberosUtil.getDefaultRealm()) match { case (value: String)scala.util.Success[String]((realm @ _)) => org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String)) case (exception: Throwable)scala.util.Failure[String]((e @ _)) => { (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Unable to get default Kerberos realm: {}", (e: AnyRef)) else (): Unit); if (principal.contains("_HOST").unary_!) principal else scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4) } }
212 89301 9267 - 9287 Apply scala.StringContext.s scala.StringContext.apply("", "@", "").s(principal, realm)
212 89303 9235 - 9302 Apply org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String))
212 89302 9289 - 9293 Literal <nosymbol> null
212 89304 9235 - 9302 Block org.apache.hadoop.security.SecurityUtil.getServerPrincipal org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@", "").s(principal, realm), (null: String))
213 89310 9327 - 9686 Block <nosymbol> { (if (HBaseConnectionPool.this.logger.underlying.isWarnEnabled()) HBaseConnectionPool.this.logger.underlying.warn("Unable to get default Kerberos realm: {}", (e: AnyRef)) else (): Unit); if (principal.contains("_HOST").unary_!) principal else scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4) }
215 89305 9431 - 9460 Literal <nosymbol> "_HOST"
215 89307 9465 - 9474 Ident org.locationtech.geomesa.hbase.data.HBaseConnectionPool.principal principal
215 89306 9411 - 9461 Select scala.Boolean.unary_! principal.contains("_HOST").unary_!
217 89309 9597 - 9674 Block scala.collection.IndexedSeqOptimized.dropRight scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4)
217 89308 9597 - 9674 Apply scala.collection.IndexedSeqOptimized.dropRight scala.Predef.augmentString(org.apache.hadoop.security.SecurityUtil.getServerPrincipal(scala.StringContext.apply("", "@foo").s(principal), (null: String))).dropRight(4)
238 89313 10267 - 10277 Select org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.connection SingletonConnection.this.connection
238 89312 10245 - 10253 Select org.locationtech.geomesa.hbase.data.HBaseConnectionPool.SingletonConnection.kerberos SingletonConnection.this.kerberos
238 89315 10260 - 10260 TypeApply scala.collection.Seq.canBuildFrom collection.this.Seq.canBuildFrom[java.io.Closeable]
238 89314 10263 - 10278 Apply scala.collection.generic.GenericCompanion.apply scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection)
238 89317 10244 - 10244 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.iterableIsCloseable io.this.IsCloseable.iterableIsCloseable
238 89316 10245 - 10278 ApplyToImplicitArgs scala.collection.TraversableLike.++ scala.this.Option.option2Iterable[java.io.Closeable](SingletonConnection.this.kerberos).toSeq.++[java.io.Closeable, Seq[java.io.Closeable]](scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection))(collection.this.Seq.canBuildFrom[java.io.Closeable])
238 89319 10244 - 10244 Literal <nosymbol> ()
238 89318 10228 - 10279 ApplyToImplicitArgs org.locationtech.geomesa.utils.io.CloseWithLogging.apply org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.apply[Seq[java.io.Closeable]](scala.this.Option.option2Iterable[java.io.Closeable](SingletonConnection.this.kerberos).toSeq.++[java.io.Closeable, Seq[java.io.Closeable]](scala.collection.Seq.apply[org.apache.hadoop.hbase.client.Connection](SingletonConnection.this.connection))(collection.this.Seq.canBuildFrom[java.io.Closeable]))(io.this.IsCloseable.iterableIsCloseable)
248 89320 10565 - 10567 Literal <nosymbol> ()
257 89321 10805 - 10807 Literal <nosymbol> ()