Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-9886][CORE] Fix to use ShutdownHookManager in #10313

Closed

Conversation

naveenminchu
Copy link
Contributor

ExternalBlockStore.scala

@srowen
Copy link
Member

srowen commented Dec 15, 2015

LGTM, but not sure how we missed this one. It makes me wonder if there's a particular reason for it. But I don't see a reason the current implementation would guarantee some behavior that's required.

@JoshRosen
Copy link
Contributor

Hey, can we add a linter rule to ban uses of "Runtime.getRuntime.addShutdownHook", similar to our existing rule for "Class.forName", which recommends using our own utility function instead?

@naveenminchu
Copy link
Contributor Author

Hi @JoshRosen, Are you suggesting to go ahead look over "Runtime.getRuntime.addShutdownHook" use and get rid of same

@JoshRosen
Copy link
Contributor

@naveenminchu, yeah, I'm suggesting that we add a rule to scalastyle-config.xml (like

<check customId="classforname" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
), add excludes to ignore the legitimate uses, then fix any violations that we find (see #7350 for an example of this)

I suppose the Scalastyle lint doesn't catch similar problems in Java code, but I say "let's not let perfect be the enemy of the good" here; it's better to have some checks vs. no checks.

@srowen
Copy link
Member

srowen commented Dec 15, 2015

The comment from @vanzin on the JIRA indicated he wasn't sure whether the other 2 usages were better left alone as they're used in particular stand-alone processes. But I suppose it doesn't really hurt to use the fancy wrapper in those cases too.

@SparkQA
Copy link

SparkQA commented Dec 15, 2015

Test build #2218 has finished for PR 10313 at commit 2672ddb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@andrewor14
Copy link
Contributor

Merging into master 1.6. We can add the scalastyle check later.

asfgit pushed a commit that referenced this pull request Dec 16, 2015
ExternalBlockStore.scala

Author: Naveen <naveenminchu@gmail.com>

Closes #10313 from naveenminchu/branch-fix-SPARK-9886.

(cherry picked from commit 8a215d2)
Signed-off-by: Andrew Or <andrew@databricks.com>
@asfgit asfgit closed this in 8a215d2 Dec 16, 2015
@tedyu
Copy link
Contributor

tedyu commented Dec 16, 2015

There're still 3 references to Runtime.getRuntime.addShutdownHook() in the code base.
Should they be replaced with ShutdownHookManager ?

@andrewor14
Copy link
Contributor

I believe so, and we can also add a scalastyle check that Josh suggested

@tedyu
Copy link
Contributor

tedyu commented Dec 16, 2015

Created #10325

@naveenminchu
Copy link
Contributor Author

@tedyu Thanks for making those changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants