Skip to content

Commit

Permalink
HadoopSecurity should be a Singleton (#284)
Browse files Browse the repository at this point in the history
* HadoopSecurity should be a singleton

* Update build to the last recognized successful deployment (Linkedin)
  • Loading branch information
akshayrai authored Sep 8, 2017
1 parent 016f71e commit 2dad926
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions app/com/linkedin/drelephant/security/HadoopSecurity.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ public class HadoopSecurity {
private static HadoopSecurity instance = null;

public static HadoopSecurity getInstance() throws IOException{
if(instance==null) {
return new HadoopSecurity();
if (instance == null) {
instance = new HadoopSecurity();
}

return instance;
}

public HadoopSecurity() throws IOException {
private HadoopSecurity() throws IOException {
Configuration conf = new Configuration();
UserGroupInformation.setConfiguration(conf);
_securityEnabled = UserGroupInformation.isSecurityEnabled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SparkLogClient(hadoopConfiguration: Configuration, sparkConf: SparkConf, e

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

private lazy val security: HadoopSecurity = new HadoopSecurity()
private lazy val security: HadoopSecurity = HadoopSecurity.getInstance()

protected lazy val sparkUtils: SparkUtils = SparkUtils

Expand Down
2 changes: 1 addition & 1 deletion app/org/apache/spark/deploy/history/SparkFSFetcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class SparkFSFetcher(fetcherConfData: FetcherConfigurationData) extends Elephant
val eventLogUri = Option(fetcherConfData.getParamMap.get(LOG_LOCATION_URI_XML_FIELD))
logger.info("The event log location of Spark application is set to " + eventLogUri)

private lazy val security = new HadoopSecurity()
private lazy val security = HadoopSecurity.getInstance()

protected lazy val hadoopUtils: HadoopUtils = HadoopUtils

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Dependencies._

name := "dr-elephant"

version := "2.0.6"
version := "2.0.13"

organization := "com.linkedin.drelephant"

Expand Down

0 comments on commit 2dad926

Please sign in to comment.