From reviews-return-1752-archive-asf-public=cust-asf.ponee.io@livy.incubator.apache.org Mon Sep 2 07:16:38 2019 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 [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id CDAF1180658 for ; Mon, 2 Sep 2019 09:16:37 +0200 (CEST) Received: (qmail 53653 invoked by uid 500); 2 Sep 2019 07:31:05 -0000 Mailing-List: contact reviews-help@livy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@livy.incubator.apache.org Delivered-To: mailing list reviews@livy.incubator.apache.org Received: (qmail 53642 invoked by uid 99); 2 Sep 2019 07:31:05 -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; Mon, 02 Sep 2019 07:31:05 +0000 From: GitBox To: reviews@livy.apache.org Subject: [GitHub] [incubator-livy] jerryshao commented on a change in pull request #220: [LIVY-654] Ability to validate string before creating state/kind of session/statement Message-ID: <156740859706.17304.4331074070095461271.gitbox@gitbox.apache.org> Date: Mon, 02 Sep 2019 07:16:37 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit jerryshao commented on a change in pull request #220: [LIVY-654] Ability to validate string before creating state/kind of session/statement URL: https://github.com/apache/incubator-livy/pull/220#discussion_r319831295 ########## File path: core/src/main/scala/org/apache/livy/sessions/SessionState.scala ########## @@ -30,33 +30,33 @@ class FinishedSessionState( object SessionState { def apply(s: String): SessionState = s match { - case "not_started" => NotStarted - case "starting" => Starting - case "recovering" => Recovering - case "idle" => Idle - case "running" => Running - case "busy" => Busy - case "shutting_down" => ShuttingDown + case "not_started" => NotStarted() + case "starting" => Starting() + case "recovering" => Recovering() + case "idle" => Idle() + case "running" => Running() + case "busy" => Busy() + case "shutting_down" => ShuttingDown() case "error" => Error() case "dead" => Dead() case "killed" => Killed() case "success" => Success() case _ => throw new IllegalArgumentException(s"Illegal session state: $s") } - object NotStarted extends SessionState("not_started", true) + case class NotStarted() extends SessionState("not_started", true) - object Starting extends SessionState("starting", true) + case class Starting() extends SessionState("starting", true) - object Recovering extends SessionState("recovering", true) + case class Recovering() extends SessionState("recovering", true) - object Idle extends SessionState("idle", true) + case class Idle() extends SessionState("idle", true) - object Running extends SessionState("running", true) + case class Running() extends SessionState("running", true) - object Busy extends SessionState("busy", true) + case class Busy() extends SessionState("busy", true) - object ShuttingDown extends SessionState("shutting_down", false) + case class ShuttingDown() extends SessionState("shutting_down", false) Review comment: The changes here will create many small `SessionState` objects, which is unnecessary and can be replaced by singleton. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services