pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jerrypeng commented on a change in pull request #3165: Check if log folder exists
Date Tue, 11 Dec 2018 23:29:33 GMT
jerrypeng commented on a change in pull request #3165: Check if log folder exists
URL: https://github.com/apache/pulsar/pull/3165#discussion_r240831476
 
 

 ##########
 File path: pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/ProcessRuntime.java
 ##########
 @@ -139,15 +139,19 @@ public void start() {
 
         // Note: we create the expected log folder before the function process logger attempts
to create it
         // This is because if multiple instances are launched they can encounter a race condition
creation of the dir.
-        log.info("Creating function log directory {}", funcLogDir);
-        boolean success = createFolder(funcLogDir);
 
-        if (!success) {
-            log.error("Log folder could not be created : {}", funcLogDir);
-            throw new RuntimeException("Log folder creation error");
-        }
+        final File dir = new File(funcLogDir);
+        if (!dir.exists()) {
+            log.info("Creating function log directory {}", funcLogDir);
+            boolean success = createFolder(funcLogDir);
 
 Review comment:
   I wouldn't bother checking the return of mkdir and then throwing an exception based on
it.  

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message