You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by ni...@apache.org on 2017/04/19 00:04:35 UTC
samza git commit: SAMZA-1215,
SAMZA-1216: remove ProcessKiller and change the ZooKeeper connection
string in test
Repository: samza
Updated Branches:
refs/heads/master 2e602c46f -> 0b0b2958e
SAMZA-1215, SAMZA-1216: remove ProcessKiller and change the ZooKeeper connection string in test
\u2026 test to use 127.0.0.1 in connect string
Author: Yi Pan (Data Infrastructure) <ni...@gmail.com>
Reviewers: Navina Ramesh <na...@apache.org>
Closes #129 from nickpan47/fix-some-tests
Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/0b0b2958
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/0b0b2958
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/0b0b2958
Branch: refs/heads/master
Commit: 0b0b2958e34664511b22805543947aa71a7d1d8c
Parents: 2e602c4
Author: Yi Pan (Data Infrastructure) <ni...@gmail.com>
Authored: Tue Apr 18 17:04:29 2017 -0700
Committer: Yi Pan (Data Infrastructure) <ni...@gmail.com>
Committed: Tue Apr 18 17:04:29 2017 -0700
----------------------------------------------------------------------
.../apache/samza/job/util/ProcessKiller.java | 48 --------------------
.../org/apache/samza/job/local/ProcessJob.scala | 3 +-
.../zk/TestZkBarrierForVersionUpgrade.java | 2 +-
3 files changed, 2 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/samza/blob/0b0b2958/samza-core/src/main/java/org/apache/samza/job/util/ProcessKiller.java
----------------------------------------------------------------------
diff --git a/samza-core/src/main/java/org/apache/samza/job/util/ProcessKiller.java b/samza-core/src/main/java/org/apache/samza/job/util/ProcessKiller.java
deleted file mode 100644
index 62a0703..0000000
--- a/samza-core/src/main/java/org/apache/samza/job/util/ProcessKiller.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.samza.job.util;
-
-import java.lang.reflect.Method;
-
-
-/**
- * Kills a {@link Process} consistently, independent of Java version.
- */
-public class ProcessKiller {
- /**
- * Force-kills the process independently of Java implementation.
- *
- * In Java 7, destroy() would force kill the process.
- *
- * Java 8 changed the behavior of destroy() to be normal
- * termination and added destroyForcibly(), sigh.
- *
- * TODO: remove this class when Java 7 is no longer supported.
- *
- * @param process the process to destroy.
- */
- public static void destroyForcibly(Process process) {
- try {
- Method methodToFind = Process.class.getMethod("destroyForcibly", (Class<?>[]) null);
- methodToFind.invoke(process);
- } catch (Exception e) {
- process.destroy();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/samza/blob/0b0b2958/samza-core/src/main/scala/org/apache/samza/job/local/ProcessJob.scala
----------------------------------------------------------------------
diff --git a/samza-core/src/main/scala/org/apache/samza/job/local/ProcessJob.scala b/samza-core/src/main/scala/org/apache/samza/job/local/ProcessJob.scala
index 59444a3..f068773 100644
--- a/samza-core/src/main/scala/org/apache/samza/job/local/ProcessJob.scala
+++ b/samza-core/src/main/scala/org/apache/samza/job/local/ProcessJob.scala
@@ -25,7 +25,6 @@ import java.util.concurrent.CountDownLatch
import org.apache.samza.SamzaException
import org.apache.samza.coordinator.JobModelManager
import org.apache.samza.job.ApplicationStatus.{New, Running, UnsuccessfulFinish}
-import org.apache.samza.job.util.ProcessKiller
import org.apache.samza.job.{ApplicationStatus, CommandBuilder, StreamJob}
import org.apache.samza.util.Logging
@@ -70,7 +69,7 @@ class ProcessJob(commandBuilder: CommandBuilder, jobCoordinator: JobModelManager
}
def kill: StreamJob = {
- ProcessKiller.destroyForcibly(process)
+ process.destroyForcibly
jobStatus = Some(UnsuccessfulFinish);
ProcessJob.this
}
http://git-wip-us.apache.org/repos/asf/samza/blob/0b0b2958/samza-core/src/test/java/org/apache/samza/zk/TestZkBarrierForVersionUpgrade.java
----------------------------------------------------------------------
diff --git a/samza-core/src/test/java/org/apache/samza/zk/TestZkBarrierForVersionUpgrade.java b/samza-core/src/test/java/org/apache/samza/zk/TestZkBarrierForVersionUpgrade.java
index b0ed963..3f2c265 100644
--- a/samza-core/src/test/java/org/apache/samza/zk/TestZkBarrierForVersionUpgrade.java
+++ b/samza-core/src/test/java/org/apache/samza/zk/TestZkBarrierForVersionUpgrade.java
@@ -48,7 +48,7 @@ public class TestZkBarrierForVersionUpgrade {
public static void setup() throws InterruptedException {
zkServer = new EmbeddedZookeeper();
zkServer.setup();
- testZkConnectionString = "localhost:" + zkServer.getPort();
+ testZkConnectionString = "127.0.0.1:" + zkServer.getPort();
}
@Before