You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by aj...@apache.org on 2015/11/23 17:34:03 UTC
falcon git commit: FALCON-1622 On starting falcon server JPS shows
Main and not Falcon. Contributed by Sandeep Samudrala.
Repository: falcon
Updated Branches:
refs/heads/master c4958773d -> f018fafb4
FALCON-1622 On starting falcon server JPS shows Main and not Falcon. Contributed by Sandeep Samudrala.
Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/f018fafb
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/f018fafb
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/f018fafb
Branch: refs/heads/master
Commit: f018fafb41d7d435c78ddbea71c8aea86c36a2e0
Parents: c495877
Author: Ajay Yadava <aj...@gmail.com>
Authored: Mon Nov 23 21:42:41 2015 +0530
Committer: Ajay Yadava <aj...@gmail.com>
Committed: Mon Nov 23 21:42:41 2015 +0530
----------------------------------------------------------------------
CHANGES.txt | 2 +
.../java/org/apache/falcon/FalconServer.java | 141 +++++++++++++++++++
prism/src/main/java/org/apache/falcon/Main.java | 141 -------------------
src/bin/service-start.sh | 2 +-
4 files changed, 144 insertions(+), 142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/falcon/blob/f018fafb/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e4ee8f8..66bfa9d 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -18,6 +18,8 @@ Trunk (Unreleased)
FALCON-1213 Base framework of the native scheduler(Pallavi Rao)
IMPROVEMENTS
+ FALCON-1622 On starting falcon server JPS shows Main and not Falcon(Sandeep Samudrala via Ajay Yadava)
+
FALCON-1607 Native Scheduler - Code refactoring: Refactor ID into more specific sub classes(Ajay Yadava)
FALCON-1587 Divide FalconCLI.twiki into sub sections for different modules on the lines of REST Api(Praveen Adlakha via Ajay Yadava)
http://git-wip-us.apache.org/repos/asf/falcon/blob/f018fafb/prism/src/main/java/org/apache/falcon/FalconServer.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/FalconServer.java b/prism/src/main/java/org/apache/falcon/FalconServer.java
new file mode 100644
index 0000000..d50ebe5
--- /dev/null
+++ b/prism/src/main/java/org/apache/falcon/FalconServer.java
@@ -0,0 +1,141 @@
+/**
+ * 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.falcon;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.falcon.util.BuildProperties;
+import org.apache.falcon.util.EmbeddedServer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.falcon.util.StartupProperties;
+
+/**
+ * Driver for running Falcon as a standalone server with embedded jetty server.
+ */
+public final class FalconServer {
+ private static final Logger LOG = LoggerFactory.getLogger(FalconServer.class);
+ private static final String APP_PATH = "app";
+ private static final String APP_PORT = "port";
+ private static EmbeddedServer server;
+ private static BrokerService broker;
+
+ /**
+ * Prevent users from constructing this.
+ */
+ private FalconServer() {
+ }
+
+ private static CommandLine parseArgs(String[] args) throws ParseException {
+ Options options = new Options();
+ Option opt;
+
+ opt = new Option(APP_PATH, true, "Application Path");
+ opt.setRequired(false);
+ options.addOption(opt);
+
+ opt = new Option(APP_PORT, true, "Application Port");
+ opt.setRequired(false);
+ options.addOption(opt);
+
+ return new GnuParser().parse(options, args);
+ }
+
+ static class ShutDown extends Thread {
+ public void run() {
+ try {
+ LOG.info("calling shutdown hook");
+ if (server != null) {
+ server.stop();
+ }
+ if (broker != null) {
+ broker.stop();
+ }
+ LOG.info("Shutdown Complete.");
+ } catch (Exception e) {
+ LOG.error("Server shutdown failed with " , e);
+ }
+ }
+ }
+ public static void main(String[] args) throws Exception {
+ Runtime.getRuntime().addShutdownHook(new ShutDown());
+ CommandLine cmd = parseArgs(args);
+ String projectVersion = BuildProperties.get().getProperty("project.version");
+ String appPath = "webapp/target/falcon-webapp-" + projectVersion;
+
+ if (cmd.hasOption(APP_PATH)) {
+ appPath = cmd.getOptionValue(APP_PATH);
+ }
+
+ final String enableTLSFlag = StartupProperties.get().getProperty("falcon.enableTLS");
+ final int appPort = getApplicationPort(cmd, enableTLSFlag);
+ final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
+ StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS));
+
+ startEmbeddedMQIfEnabled();
+
+ LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
+ LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
+ LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
+ server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
+ server.start();
+ }
+
+ private static int getApplicationPort(CommandLine cmd, String enableTLSFlag) {
+ final int appPort;
+ if (cmd.hasOption(APP_PORT)) {
+ appPort = Integer.valueOf(cmd.getOptionValue(APP_PORT));
+ } else {
+ // default : falcon.enableTLS is true
+ appPort = StringUtils.isEmpty(enableTLSFlag)
+ || enableTLSFlag.equals("true") ? 15443 : 15000;
+ }
+
+ return appPort;
+ }
+
+ private static boolean isTLSEnabled(String enableTLSFlag, int appPort) {
+ return Boolean.valueOf(StringUtils.isEmpty(enableTLSFlag)
+ ? System.getProperty("falcon.enableTLS", (appPort % 1000) == 443 ? "true" : "false")
+ : enableTLSFlag);
+ }
+
+ private static void startEmbeddedMQIfEnabled() throws Exception {
+ boolean startActiveMq = Boolean.valueOf(System.getProperty("falcon.embeddedmq", "true"));
+ if (startActiveMq) {
+ String dataDir = System.getProperty("falcon.embeddedmq.data", "target/");
+ int mqport = Integer.valueOf(System.getProperty("falcon.embeddedmq.port", "61616"));
+ LOG.info("Starting ActiveMQ at port {} with data dir {}", mqport, dataDir);
+
+ broker = new BrokerService();
+ broker.setUseJmx(false);
+ broker.setDataDirectory(dataDir);
+ broker.addConnector("vm://localhost");
+ broker.addConnector("tcp://0.0.0.0:" + mqport);
+ broker.setSchedulerSupport(true);
+ broker.setUseShutdownHook(false);
+ broker.start();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/falcon/blob/f018fafb/prism/src/main/java/org/apache/falcon/Main.java
----------------------------------------------------------------------
diff --git a/prism/src/main/java/org/apache/falcon/Main.java b/prism/src/main/java/org/apache/falcon/Main.java
deleted file mode 100644
index b0f19ae..0000000
--- a/prism/src/main/java/org/apache/falcon/Main.java
+++ /dev/null
@@ -1,141 +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.falcon;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.util.BuildProperties;
-import org.apache.falcon.util.EmbeddedServer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.falcon.util.StartupProperties;
-
-/**
- * Driver for running Falcon as a standalone server with embedded jetty server.
- */
-public final class Main {
- private static final Logger LOG = LoggerFactory.getLogger(Main.class);
- private static final String APP_PATH = "app";
- private static final String APP_PORT = "port";
- private static EmbeddedServer server;
- private static BrokerService broker;
-
- /**
- * Prevent users from constructing this.
- */
- private Main() {
- }
-
- private static CommandLine parseArgs(String[] args) throws ParseException {
- Options options = new Options();
- Option opt;
-
- opt = new Option(APP_PATH, true, "Application Path");
- opt.setRequired(false);
- options.addOption(opt);
-
- opt = new Option(APP_PORT, true, "Application Port");
- opt.setRequired(false);
- options.addOption(opt);
-
- return new GnuParser().parse(options, args);
- }
-
- static class ShutDown extends Thread {
- public void run() {
- try {
- LOG.info("calling shutdown hook");
- if (server != null) {
- server.stop();
- }
- if (broker != null) {
- broker.stop();
- }
- LOG.info("Shutdown Complete.");
- } catch (Exception e) {
- LOG.error("Server shutdown failed with " , e);
- }
- }
- }
- public static void main(String[] args) throws Exception {
- Runtime.getRuntime().addShutdownHook(new ShutDown());
- CommandLine cmd = parseArgs(args);
- String projectVersion = BuildProperties.get().getProperty("project.version");
- String appPath = "webapp/target/falcon-webapp-" + projectVersion;
-
- if (cmd.hasOption(APP_PATH)) {
- appPath = cmd.getOptionValue(APP_PATH);
- }
-
- final String enableTLSFlag = StartupProperties.get().getProperty("falcon.enableTLS");
- final int appPort = getApplicationPort(cmd, enableTLSFlag);
- final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort);
- StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS));
-
- startEmbeddedMQIfEnabled();
-
- LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
- LOG.info("Server starting with TLS ? {} on port {}", enableTLS, appPort);
- LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
- server = EmbeddedServer.newServer(appPort, appPath, enableTLS);
- server.start();
- }
-
- private static int getApplicationPort(CommandLine cmd, String enableTLSFlag) {
- final int appPort;
- if (cmd.hasOption(APP_PORT)) {
- appPort = Integer.valueOf(cmd.getOptionValue(APP_PORT));
- } else {
- // default : falcon.enableTLS is true
- appPort = StringUtils.isEmpty(enableTLSFlag)
- || enableTLSFlag.equals("true") ? 15443 : 15000;
- }
-
- return appPort;
- }
-
- private static boolean isTLSEnabled(String enableTLSFlag, int appPort) {
- return Boolean.valueOf(StringUtils.isEmpty(enableTLSFlag)
- ? System.getProperty("falcon.enableTLS", (appPort % 1000) == 443 ? "true" : "false")
- : enableTLSFlag);
- }
-
- private static void startEmbeddedMQIfEnabled() throws Exception {
- boolean startActiveMq = Boolean.valueOf(System.getProperty("falcon.embeddedmq", "true"));
- if (startActiveMq) {
- String dataDir = System.getProperty("falcon.embeddedmq.data", "target/");
- int mqport = Integer.valueOf(System.getProperty("falcon.embeddedmq.port", "61616"));
- LOG.info("Starting ActiveMQ at port {} with data dir {}", mqport, dataDir);
-
- broker = new BrokerService();
- broker.setUseJmx(false);
- broker.setDataDirectory(dataDir);
- broker.addConnector("vm://localhost");
- broker.addConnector("tcp://0.0.0.0:" + mqport);
- broker.setSchedulerSupport(true);
- broker.setUseShutdownHook(false);
- broker.start();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/falcon/blob/f018fafb/src/bin/service-start.sh
----------------------------------------------------------------------
diff --git a/src/bin/service-start.sh b/src/bin/service-start.sh
index 4a030de..4766130 100755
--- a/src/bin/service-start.sh
+++ b/src/bin/service-start.sh
@@ -52,7 +52,7 @@ while [[ ${1} =~ ^\-D ]]; do
done
TIME=`date +%Y%m%d%H%M%s`
-nohup ${JAVA_BIN} ${JAVA_PROPERTIES} -cp ${FALCONCPPATH} org.apache.falcon.Main -app ${BASEDIR}/server/webapp/${APP_TYPE} $* > "${FALCON_LOG_DIR}/$APP_TYPE.out.$TIME" 2>&1 < /dev/null &
+nohup ${JAVA_BIN} ${JAVA_PROPERTIES} -cp ${FALCONCPPATH} org.apache.falcon.FalconServer -app ${BASEDIR}/server/webapp/${APP_TYPE} $* > "${FALCON_LOG_DIR}/$APP_TYPE.out.$TIME" 2>&1 < /dev/null &
echo $! > $FALCON_PID_FILE
popd > /dev/null