Skip to content

Commit 2dad926

Browse files
authored
HadoopSecurity should be a Singleton (#284)
* HadoopSecurity should be a singleton * Update build to the last recognized successful deployment (Linkedin)
1 parent 016f71e commit 2dad926

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

app/com/linkedin/drelephant/security/HadoopSecurity.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ public class HadoopSecurity {
4141
private static HadoopSecurity instance = null;
4242

4343
public static HadoopSecurity getInstance() throws IOException{
44-
if(instance==null) {
45-
return new HadoopSecurity();
44+
if (instance == null) {
45+
instance = new HadoopSecurity();
4646
}
47+
4748
return instance;
4849
}
4950

50-
public HadoopSecurity() throws IOException {
51+
private HadoopSecurity() throws IOException {
5152
Configuration conf = new Configuration();
5253
UserGroupInformation.setConfiguration(conf);
5354
_securityEnabled = UserGroupInformation.isSecurityEnabled();

app/com/linkedin/drelephant/spark/fetchers/SparkLogClient.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SparkLogClient(hadoopConfiguration: Configuration, sparkConf: SparkConf, e
4343

4444
private val logger: Logger = Logger.getLogger(classOf[SparkLogClient])
4545

46-
private lazy val security: HadoopSecurity = new HadoopSecurity()
46+
private lazy val security: HadoopSecurity = HadoopSecurity.getInstance()
4747

4848
protected lazy val sparkUtils: SparkUtils = SparkUtils
4949

app/org/apache/spark/deploy/history/SparkFSFetcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class SparkFSFetcher(fetcherConfData: FetcherConfigurationData) extends Elephant
5252
val eventLogUri = Option(fetcherConfData.getParamMap.get(LOG_LOCATION_URI_XML_FIELD))
5353
logger.info("The event log location of Spark application is set to " + eventLogUri)
5454

55-
private lazy val security = new HadoopSecurity()
55+
private lazy val security = HadoopSecurity.getInstance()
5656

5757
protected lazy val hadoopUtils: HadoopUtils = HadoopUtils
5858

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import Dependencies._
1919

2020
name := "dr-elephant"
2121

22-
version := "2.0.6"
22+
version := "2.0.13"
2323

2424
organization := "com.linkedin.drelephant"
2525

0 commit comments

Comments
 (0)