From commits-return-18882-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Wed Dec 12 00:29:35 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 352E9180676 for ; Wed, 12 Dec 2018 00:29:35 +0100 (CET) Received: (qmail 82070 invoked by uid 500); 11 Dec 2018 23:29:34 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 82061 invoked by uid 99); 11 Dec 2018 23:29:34 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2018 23:29:34 +0000 From: GitBox To: commits@pulsar.apache.org Subject: [GitHub] jerrypeng commented on a change in pull request #3165: Check if log folder exists Message-ID: <154457097384.19378.12105627062864645554.gitbox@gitbox.apache.org> Date: Tue, 11 Dec 2018 23:29:33 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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