jayendrap commented on code in PR #476:
URL: https://github.com/apache/atlas/pull/476#discussion_r2580011568
##########
intg/src/main/java/org/apache/atlas/ApplicationProperties.java:
##########
@@ -124,27 +124,57 @@ public static Configuration set(Configuration
configuration) throws AtlasExcepti
return instance;
}
- public static Configuration get(String fileName) throws AtlasException {
- String confLocation =
System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+ public static Configuration getConf(String absoluteFilePath) throws
AtlasException {
Review Comment:
Consider renaming to method name to "getConfFromAbsolutePath"
##########
intg/src/main/java/org/apache/atlas/ApplicationProperties.java:
##########
@@ -124,27 +124,57 @@ public static Configuration set(Configuration
configuration) throws AtlasExcepti
return instance;
}
- public static Configuration get(String fileName) throws AtlasException {
- String confLocation =
System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+ public static Configuration getConf(String absoluteFilePath) throws
AtlasException {
+ if (instance == null) {
+ synchronized (ApplicationProperties.class) {
+ if (instance == null) {
+ set(get(absoluteFilePath));
+ }
+ }
+ }
+ return instance;
+ }
+ public static Configuration getConf(PropertiesConfiguration clientConf)
throws AtlasException {
Review Comment:
Consider renaming the method name to "get" instead of "getConf"
##########
intg/src/main/java/org/apache/atlas/ApplicationProperties.java:
##########
@@ -124,27 +124,57 @@ public static Configuration set(Configuration
configuration) throws AtlasExcepti
return instance;
}
- public static Configuration get(String fileName) throws AtlasException {
- String confLocation =
System.getProperty(ATLAS_CONFIGURATION_DIRECTORY_PROPERTY);
+ public static Configuration getConf(String absoluteFilePath) throws
AtlasException {
+ if (instance == null) {
+ synchronized (ApplicationProperties.class) {
+ if (instance == null) {
+ set(get(absoluteFilePath));
+ }
+ }
+ }
+ return instance;
+ }
+ public static Configuration getConf(PropertiesConfiguration clientConf)
throws AtlasException {
+ if (instance == null) {
+ synchronized (ApplicationProperties.class) {
+ if (instance == null) {
+ set(clientConf);
+ }
+ }
+ }
+ return instance;
+ }
+
+ public static Configuration get(String fileName) throws AtlasException {
try {
- URL url;
+ URL url = null;
- if (confLocation == null) {
- LOG.info("Looking for {} in classpath", fileName);
+ if (StringUtils.isNotBlank(fileName)) {
+ File file = new File(fileName);
+ if (file.exists()) {
+ url = file.toURI().toURL();
+ LOG.info("Loading {} from {}", fileName, url);
Review Comment:
Same log is also printed at the end of the method, so we can remove this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]