avikganguly01 commented on a change in pull request #459: FINERACT-429: Node 
aware Scheduler
URL: https://github.com/apache/fineract/pull/459#discussion_r197642959
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/service/JobRegisterServiceImpl.java
 ##########
 @@ -129,6 +135,30 @@ public void loadAllJobs() {
         }
     }
 
+    private void readAndSetSchedulerNode() {
+        Properties prop = new Properties();
+        String homeDirectory = System.getProperty("user.home");
+        FileInputStream fis = null;
+        String nodeKey = "node.id";
+        String defaultValue = "1";
+        try {
+            File file = new File(homeDirectory + "/fineract.properties");
+            fis = new FileInputStream(file);
+            prop.load(fis);
+            String nodeValue = prop.getProperty(nodeKey);
+            if (!StringUtils.isBlank(nodeValue)) {
+                System.setProperty(nodeKey, nodeValue);
+            } else {
+                System.setProperty(nodeKey, defaultValue);
+            }
+            fis.close();
+        } catch (FileNotFoundException e) {
+            System.setProperty(nodeKey, defaultValue);
+        } catch (IOException e) {
+            System.setProperty(nodeKey, defaultValue);
+        }
+    }
+
     public void executeJob(final ScheduledJobDetail scheduledJobDetail, String 
triggerType) {
         try {
 
 Review comment:
   I see only changes in executeJob function and not in schedule function.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to