You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/03/12 15:24:48 UTC
[1/4] git commit: updating file clearing on start and stop
Repository: airavata
Updated Branches:
refs/heads/master 4a0571d6b -> 13c67c460
updating file clearing on start and stop
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e181bfb2
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e181bfb2
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e181bfb2
Branch: refs/heads/master
Commit: e181bfb24c01e142e8ee4e92ce30d80ca3c029e9
Parents: 58872ce
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Tue Mar 11 15:51:50 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Tue Mar 11 15:51:50 2014 -0400
----------------------------------------------------------------------
.../common/utils/ApplicationSettings.java | 17 +++++++-
.../airavata/common/utils/StringUtil.java | 5 ++-
.../src/main/assembly/bin-assembly.xml | 18 --------
.../src/main/resources/bin/airavata-server.sh | 14 +++---
.../resources/conf/airavata-server.properties | 3 ++
.../org/apache/airavata/server/ServerMain.java | 45 +++++++++++++++++++-
6 files changed, 73 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
index 82bf4dc..ea3b1ef 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
@@ -54,6 +54,11 @@ public abstract class ApplicationSettings {
private final static Logger logger = LoggerFactory.getLogger(ApplicationSettings.class);
+ private static final String SHUTDOWN_STATEGY_STRING="shutdown.strategy";
+ public static enum ShutdownStrategy{
+ NONE,
+ SELF_TERMINATE
+ }
static{
loadProperties();
}
@@ -265,5 +270,15 @@ public abstract class ApplicationSettings {
public static void mergeSettingsCommandLineArgs(String[] args){
properties.putAll(StringUtil.parseCommandLineOptions(args));
}
-
+
+ public static ShutdownStrategy getShutdownStrategy() throws Exception{
+ String strategy = null;
+ try {
+ strategy = getSetting(SHUTDOWN_STATEGY_STRING, ShutdownStrategy.SELF_TERMINATE.toString());
+ return ShutdownStrategy.valueOf(strategy);
+ } catch (Exception e) {
+ //if the string mentioned in config is invalid
+ throw new Exception("Invalid shutdown strategy configured : "+strategy);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
index 6356326..3ce5cda 100644
--- a/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/StringUtil.java
@@ -404,8 +404,9 @@ public class StringUtil {
Map<String,String> commandLineOptions=new HashMap<String,String>();
try {
CommandLineParameters cmdParameters = getCommandLineParser(args);
- for (String s : cmdParameters.getParameters().keySet()) {
- commandLineOptions.put(s, cmdParameters.getParameters().get(s));
+ Map<String, String> parameters = cmdParameters.getParameters();
+ for (String s : parameters.keySet()) {
+ commandLineOptions.put(s, parameters.get(s)==null? "":parameters.get(s));
}
} catch (ParseException e1) {
e1.printStackTrace();
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml b/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml
index ab3bbf3..cd75afa 100644
--- a/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml
+++ b/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml
@@ -229,26 +229,8 @@
<include>org.apache.airavata:airavata-api-server:jar</include>
<include>org.apache.airavata:airavata-api-stubs:jar</include>
<include>org.apache.openjpa:openjpa-all:jar</include>
- <include>com.sun.jersey:jersey-client:jar</include>
- <include>com.sun.jersey:jersey-core:jar</include>
<include>org.bouncycastle:bcprov-jdk16</include>
- <include>org.apache.tomcat:tomcat-jasper</include>
- <include>org.apache.tomcat:tomcat-jasper-el</include>
- <include>org.apache.tomcat:tomcat-jsp-api</include>
- <include>org.apache.tomcat.embed:tomcat-embed-core</include>
- <include>org.apache.tomcat.embed:tomcat-embed-jasper</include>
- <include>org.apache.tomcat.embed:tomcat-embed-logging-juli</include>
<include>javax.servlet:javax.servlet-api</include>
- <include>org.apache.shiro:shiro-core</include>
- <include>com.sun.jersey:jersey-servlet</include>
- <include>com.sun.jersey:jersey-json</include>
- <include>com.sun.jersey.contribs:jersey-multipart</include>
- <include>com.sun.jersey:jersey-server</include>
- <include>com.sun.jersey:jersey-client</include>
- <include>org.codehaus.jackson:jackson-jaxrs</include>
- <include>org.codehaus.jackson:jackson-core-asl</include>
- <include>org.codehaus.jackson:jackson-mapper-asl</include>
- <include>org.codehaus.jackson:jackson-xc</include>
<include>xerces:xercesImpl:jar:2.9.1</include>
<include>com.ibm.icu:icu4j</include>
<include>com.google.guava:guava</include>
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
----------------------------------------------------------------------
diff --git a/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh b/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
index 715da4e..9247d68 100755
--- a/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
+++ b/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
@@ -52,13 +52,13 @@ do
-h)
echo "Usage: airavata-server.sh [command-options]"
echo "command options:"
- echo " start Start server in daemon mode"
- echo " stop [--serverIndex n] Stop all airavata servers. Specify serverIndex stop a particular instance"
- echo " --<key>=<value> Server setting(s) to override or introduce (overrides values in airavata-server.properties)"
- echo " -nologo Do not show airavata logo"
- echo " -xdebug Start Airavata Server under JPDA debugger"
- echo " -security Enable Java 2 security"
- echo " -h Display this help and exit"
+ echo " start Start server in daemon mode"
+ echo " stop [--serverIndex n] [--force] Stop all airavata servers. Specify serverIndex stop a particular instance"
+ echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)"
+ echo " -nologo Do not show airavata logo"
+ echo " -xdebug Start Airavata Server under JPDA debugger"
+ echo " -security Enable Java 2 security"
+ echo " -h Display this help and exit"
shift
exit 0
;;
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties b/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
index 74220c2..f2bb8d7 100644
--- a/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
+++ b/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
@@ -277,4 +277,7 @@ orchestrator=org.apache.airavata.orchestrator.server.OrchestratorServer
###---------------------------API Server module Configurations---------------------------###
apiserver=org.apache.airavata.api.server.AiravataAPIServer
+###---------------------------Airavata Server Configurations---------------------------###
servers=apiserver,orchestrator
+#shutdown.trategy=NONE
+shutdown.trategy=SELF_TERMINATE
http://git-wip-us.apache.org/repos/asf/airavata/blob/e181bfb2/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index 3a25884..20534fb 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ApplicationSettings.ShutdownStrategy;
import org.apache.airavata.common.utils.IServer;
import org.apache.airavata.common.utils.IServer.ServerStatus;
import org.apache.airavata.common.utils.ServerSettings;
@@ -112,12 +113,27 @@ public class ServerMain {
if (hasStopRequested()){
ServerSettings.setStopAllThreads(true);
stopAllServers();
- System.exit(0);
+ ShutdownStrategy shutdownStrategy;
+ try {
+ shutdownStrategy = ServerSettings.getShutdownStrategy();
+ } catch (Exception e) {
+ String strategies="";
+ for(ShutdownStrategy s:ShutdownStrategy.values()){
+ strategies+="/"+s.toString();
+ }
+ logger.warn(e.getMessage());
+ logger.warn("Valid shutdown options are : "+strategies.substring(1));
+ shutdownStrategy=ShutdownStrategy.SELF_TERMINATE;
+ }
+ if (shutdownStrategy==ShutdownStrategy.SELF_TERMINATE) {
+ System.exit(0);
+ }
}
}
private static void performServerStopRequest(
CommandLineParameters commandLineParameters) throws IOException {
+ deleteOldStartRecords();
String serverIndexOption = "serverIndex";
if (commandLineParameters.getParameters().containsKey(serverIndexOption)){
serverIndex=Integer.parseInt(commandLineParameters.getParameters().get(serverIndexOption));
@@ -171,6 +187,32 @@ public class ServerMain {
return (serverIndex==-1)?stopFileNamePrefixForced:stopFileNamePrefixForced+serverIndex;
}
+ private static void deleteOldStopRequests(){
+ File[] files = new File(".").listFiles();
+ for (File file : files) {
+ if (file.getName().contains(stopFileNamePrefix) || file.getName().contains(stopFileNamePrefixForced)){
+ try {
+ file.delete();
+ } catch (Exception e) {
+ //file is locked which means there's an active process using it
+ }
+ }
+ }
+ }
+
+ private static void deleteOldStartRecords(){
+ File[] files = new File(".").listFiles();
+ for (File file : files) {
+ if (file.getName().contains(serverStartedFileNamePrefix)){
+ try {
+ file.delete();
+ } catch (Exception e) {
+ //file is locked which means there's an active process using it
+ }
+ }
+ }
+ }
+
private static boolean isServerRunning(){
if (serverIndex==-1){
String[] files = new File(".").list();
@@ -188,6 +230,7 @@ public class ServerMain {
@SuppressWarnings({ "resource" })
private static void setServerStarted(){
try {
+ deleteOldStopRequests();
File serverStartedFile = null;
while(serverStartedFile==null || serverStartedFile.exists()){
serverIndex++;
[3/4] git commit: updating server force stop to have kill commands at
unix level
Posted by sa...@apache.org.
updating server force stop to have kill commands at unix level
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/9b4dedf0
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/9b4dedf0
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/9b4dedf0
Branch: refs/heads/master
Commit: 9b4dedf0307687eef408f557c27bda56d76eb021
Parents: f9b95c9
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Wed Mar 12 10:24:24 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Wed Mar 12 10:24:24 2014 -0400
----------------------------------------------------------------------
.../src/main/resources/bin/airavata-server.sh | 63 ++++++++++----
.../org/apache/airavata/server/ServerMain.java | 88 +++++++++-----------
2 files changed, 85 insertions(+), 66 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/9b4dedf0/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
----------------------------------------------------------------------
diff --git a/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh b/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
index 9247d68..e7ed1be 100755
--- a/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
+++ b/modules/distribution/airavata-server/src/main/resources/bin/airavata-server.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -25,6 +25,8 @@ JAVA_OPTS=""
AIRAVATA_COMMAND=""
IS_DAEMON_MODE=false
LOGO=true
+STOP=false
+FORCE=false
for var in "$@"
do
case $var in
@@ -42,9 +44,14 @@ do
;;
stop)
LOGO=false
+ STOP=true
AIRAVATA_COMMAND="$AIRAVATA_COMMAND $var"
shift
;;
+ --force)
+ FORCE=true
+ shift
+ ;;
-nologo)
LOGO=false
shift
@@ -52,13 +59,13 @@ do
-h)
echo "Usage: airavata-server.sh [command-options]"
echo "command options:"
- echo " start Start server in daemon mode"
- echo " stop [--serverIndex n] [--force] Stop all airavata servers. Specify serverIndex stop a particular instance"
- echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)"
- echo " -nologo Do not show airavata logo"
- echo " -xdebug Start Airavata Server under JPDA debugger"
- echo " -security Enable Java 2 security"
- echo " -h Display this help and exit"
+ echo " start Start server in daemon mode"
+ echo " stop [--force] Stop all airavata servers."
+ echo " --<key>[=<value>] Server setting(s) to override or introduce (overrides values in airavata-server.properties)"
+ echo " -nologo Do not show airavata logo"
+ echo " -xdebug Start Airavata Server under JPDA debugger"
+ echo " -security Enable Java 2 security"
+ echo " -h Display this help and exit"
shift
exit 0
;;
@@ -73,16 +80,36 @@ if $LOGO ; then
cat $LOGO_FILE
fi
fi
-if $IS_DAEMON_MODE ; then
- echo "Starting airavata server in daemon mode..."
- nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \
- -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
- org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > airavata-server.out &
- echo
- echo
+if $STOP && $FORCE ;
+then
+ for f in `find . -name "server-start_*"`; do
+ f_split=(${f//_/ });
+ echo "Found process file : $f"
+ echo -n " Sending kill signals to process ${f_split[1]}..."
+ out=`kill -9 ${f_split[1]} 2>&1`
+ if [ -z "$out" ]; then
+ echo "done"
+ else
+ echo "failed (REASON: $out)"
+ fi
+ echo -n " Removing process file..."
+ out=`rm $f 2>&1`
+ if [ -z "$out" ]; then
+ echo "done"
+ else
+ echo "failed (REASON: $out)"
+ fi
+ done
else
- java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \
- -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
- org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $*
+ if $IS_DAEMON_MODE ; then
+ echo "Starting airavata server in daemon mode..."
+ nohup java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \
+ -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
+ org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $* > airavata-server.out &
+ else
+ java $JAVA_OPTS -classpath "$XBAYA_CLASSPATH" \
+ -Djava.endorsed.dirs="$AIRAVATA_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed" \
+ org.apache.airavata.server.ServerMain $AIRAVATA_COMMAND $*
+ fi
fi
http://git-wip-us.apache.org/repos/asf/airavata/blob/9b4dedf0/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index 20534fb..8a99013 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -22,6 +22,7 @@ package org.apache.airavata.server;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
@@ -44,10 +45,8 @@ public class ServerMain {
private final static Logger logger = LoggerFactory.getLogger(ServerMain.class);
private static boolean serversLoaded=false;
private static final String stopFileNamePrefix = "airavata-server-stop";
- private static final String stopFileNamePrefixForced = "airavata-server-stop-forced";
- private static int serverIndex=-1;
- private static final String serverStartedFileNamePrefix = "airavata-server-start";
- private static boolean forcedStop=false;
+ private static int serverPID=-1;
+ private static final String serverStartedFileNamePrefix = "server-start";
private static boolean systemShutDown=false;
static{
servers = new ArrayList<IServer>();
@@ -100,7 +99,7 @@ public class ServerMain {
private static void performServerStart(String[] args) {
setServerStarted();
- logger.info("Airavata server instance "+serverIndex+" starting...");
+ logger.info("Airavata server instance starting...");
ServerSettings.mergeSettingsCommandLineArgs(args);
startAllServers();
while(!hasStopRequested()){
@@ -136,14 +135,10 @@ public class ServerMain {
deleteOldStartRecords();
String serverIndexOption = "serverIndex";
if (commandLineParameters.getParameters().containsKey(serverIndexOption)){
- serverIndex=Integer.parseInt(commandLineParameters.getParameters().get(serverIndexOption));
- }
- String serverForcedStop = "force";
- if (commandLineParameters.getParameters().containsKey(serverForcedStop)){
- forcedStop=true;
+ serverPID=Integer.parseInt(commandLineParameters.getParameters().get(serverIndexOption));
}
if (isServerRunning()) {
- logger.info("Requesting airavata server"+(serverIndex==-1? "(s)":" instance "+serverIndex)+" to stop...");
+ logger.info("Requesting airavata server"+(serverPID==-1? "(s)":" instance "+serverPID)+" to stop...");
requestStop();
while(isServerRunning()){
try {
@@ -152,9 +147,9 @@ public class ServerMain {
e.printStackTrace();
}
}
- logger.info("Server"+(serverIndex==-1? "(s)":" instance "+serverIndex)+" stopped!!!");
+ logger.info("Server"+(serverPID==-1? "(s)":" instance "+serverPID)+" stopped!!!");
}else{
- logger.error("Server"+(serverIndex==-1? "":" instance "+serverIndex)+" is not running!!!");
+ logger.error("Server"+(serverPID==-1? "":" instance "+serverPID)+" is not running!!!");
}
}
@@ -164,38 +159,21 @@ public class ServerMain {
file.createNewFile();
new RandomAccessFile(file, "rw").getChannel().lock();
file.deleteOnExit();
- if (forcedStop){
- // incase a previous attempt of stopping without forcing is present, best to delete that file
- File f=new File((serverIndex==-1)? stopFileNamePrefix:stopFileNamePrefix+serverIndex);
- if (f.exists()){
- f.deleteOnExit();
- }
- }
}
private static boolean hasStopRequested(){
- forcedStop=new File(getServerStopForceFileName()).exists() || new File(stopFileNamePrefixForced).exists();
- return isSystemShutDown() || forcedStop || new File(getServerStopFileName()).exists() || new File(stopFileNamePrefix).exists();
+ return isSystemShutDown() || new File(getServerStopFileName()).exists() || new File(stopFileNamePrefix).exists();
}
private static String getServerStopFileName() {
- String filePrefix = forcedStop? stopFileNamePrefixForced : stopFileNamePrefix;
- return (serverIndex==-1)? filePrefix:filePrefix+serverIndex;
+ return stopFileNamePrefix;
}
- private static String getServerStopForceFileName() {
- return (serverIndex==-1)?stopFileNamePrefixForced:stopFileNamePrefixForced+serverIndex;
- }
-
private static void deleteOldStopRequests(){
File[] files = new File(".").listFiles();
for (File file : files) {
- if (file.getName().contains(stopFileNamePrefix) || file.getName().contains(stopFileNamePrefixForced)){
- try {
- file.delete();
- } catch (Exception e) {
- //file is locked which means there's an active process using it
- }
+ if (file.getName().contains(stopFileNamePrefix)){
+ file.delete();
}
}
}
@@ -205,6 +183,7 @@ public class ServerMain {
for (File file : files) {
if (file.getName().contains(serverStartedFileNamePrefix)){
try {
+ new FileOutputStream(file);
file.delete();
} catch (Exception e) {
//file is locked which means there's an active process using it
@@ -214,7 +193,7 @@ public class ServerMain {
}
private static boolean isServerRunning(){
- if (serverIndex==-1){
+ if (serverPID==-1){
String[] files = new File(".").list();
for (String file : files) {
if (file.contains(serverStartedFileNamePrefix)){
@@ -230,12 +209,10 @@ public class ServerMain {
@SuppressWarnings({ "resource" })
private static void setServerStarted(){
try {
+ serverPID = getPID();
deleteOldStopRequests();
File serverStartedFile = null;
- while(serverStartedFile==null || serverStartedFile.exists()){
- serverIndex++;
- serverStartedFile = new File(getServerStartedFileName());
- }
+ serverStartedFile = new File(getServerStartedFileName());
serverStartedFile.createNewFile();
serverStartedFile.deleteOnExit();
new RandomAccessFile(serverStartedFile,"rw").getChannel().lock();
@@ -247,20 +224,15 @@ public class ServerMain {
}
private static String getServerStartedFileName() {
- return serverStartedFileNamePrefix+serverIndex;
+ return serverStartedFileNamePrefix+"_"+Integer.toString(serverPID);
}
-
- private static int DEFAULT_FORCE_STOP_WAIT_INTERVAL=3000;
+
public static void stopAllServers() {
//stopping should be done in reverse order of starting the servers
for(int i=servers.size()-1;i>=0;i--){
try {
servers.get(i).stop();
- if (forcedStop) {
- waitForServerToStop(servers.get(i),DEFAULT_FORCE_STOP_WAIT_INTERVAL);
- }else{
- waitForServerToStop(servers.get(i),null);
- }
+ waitForServerToStop(servers.get(i),null);
} catch (Exception e) {
logger.error("Server Stop Error:",e);
}
@@ -302,7 +274,7 @@ public class ServerMain {
logger.info("Waiting for " + server.getName() + " to stop...");
}
//we are doing hasStopRequested() check because while we are stuck in the loop to stop there could be a forceStop request
- while(server.getStatus()==ServerStatus.STOPING && (maxWait==null || count<maxWait) && hasStopRequested() && (maxWait!=null || !forcedStop)){
+ while(server.getStatus()==ServerStatus.STOPING && (maxWait==null || count<maxWait)){
Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL);
count+=SERVER_STATUS_CHANGE_WAIT_INTERVAL;
}
@@ -318,4 +290,24 @@ public class ServerMain {
private static void setSystemShutDown(boolean systemShutDown) {
ServerMain.systemShutDown = systemShutDown;
}
+
+ private static int getPID(){
+ try {
+ java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory
+ .getRuntimeMXBean();
+ java.lang.reflect.Field jvm = runtime.getClass()
+ .getDeclaredField("jvm");
+ jvm.setAccessible(true);
+ sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm
+ .get(runtime);
+ java.lang.reflect.Method pid_method = mgmt.getClass()
+ .getDeclaredMethod("getProcessId");
+ pid_method.setAccessible(true);
+
+ int pid = (Integer) pid_method.invoke(mgmt);
+ return pid;
+ } catch (Exception e) {
+ return -1;
+ }
+ }
}
\ No newline at end of file
[2/4] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/airavata
Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/f9b95c93
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/f9b95c93
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/f9b95c93
Branch: refs/heads/master
Commit: f9b95c93a269fa36dacae5a0595cbbbe7f20ad18
Parents: e181bfb c00025f
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Tue Mar 11 15:54:19 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Tue Mar 11 15:54:19 2014 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 45 +++-
.../src/main/resources/registry-derby.sql | 13 +-
.../src/main/resources/registry-mysql.sql | 13 +-
.../java-client-samples/pom.xml | 10 +-
.../client/samples/CreateLaunchExperiment.java | 21 ++
.../main/resources/airavata-client.properties | 4 +-
.../airavata/client/tools/DocumentCreator.java | 6 -
modules/airavata-job-monitor/pom.xml | 22 +-
.../apache/airavata/job/monitor/MonitorID.java | 30 ++-
.../monitor/impl/pull/qstat/QstatMonitor.java | 6 +-
.../impl/push/amqp/JSONMessageParser.java | 11 +-
.../src/main/resources/schema/AccessPolicy.json | 13 +
.../src/main/resources/schema/Activity.json | 31 +++
.../src/main/resources/schema/AdminDomain.json | 51 ++++
.../schema/ApplicationEnvironment.json | 86 +++++++
.../resources/schema/ApplicationHandle.json | 21 ++
.../src/main/resources/schema/Benchmark.json | 21 ++
.../resources/schema/ComputingActivity.json | 165 +++++++++++++
.../resources/schema/ComputingEndpoint.json | 44 ++++
.../main/resources/schema/ComputingManager.json | 117 +++++++++
.../main/resources/schema/ComputingService.json | 32 +++
.../main/resources/schema/ComputingShare.json | 182 ++++++++++++++
.../src/main/resources/schema/Contact.json | 32 +++
.../src/main/resources/schema/DataStore.json | 30 +++
.../src/main/resources/schema/Domain.json | 30 +++
.../src/main/resources/schema/Endpoint.json | 147 +++++++++++
.../src/main/resources/schema/Entity.json | 35 +++
.../resources/schema/ExecutionEnvironment.json | 115 +++++++++
.../src/main/resources/schema/Glue2.json | 246 +++++++++++++++++++
.../src/main/resources/schema/Location.json | 47 ++++
.../src/main/resources/schema/Manager.json | 28 +++
.../main/resources/schema/MappingPolicy.json | 13 +
.../src/main/resources/schema/Policy.json | 27 ++
.../src/main/resources/schema/Resource.json | 27 ++
.../src/main/resources/schema/Service.json | 75 ++++++
.../src/main/resources/schema/Share.json | 45 ++++
.../resources/schema/StorageAccessProtocol.json | 32 +++
.../main/resources/schema/StorageEndpoint.json | 8 +
.../main/resources/schema/StorageManager.json | 8 +
.../main/resources/schema/StorageService.json | 22 ++
.../schema/StorageServiceCapacity.json | 33 +++
.../src/main/resources/schema/StorageShare.json | 65 +++++
.../resources/schema/StorageShareCapacity.json | 33 +++
.../resources/schema/ToComputingService.json | 32 +++
.../main/resources/schema/ToStorageService.json | 25 ++
.../src/main/resources/schema/UserDomain.json | 58 +++++
.../airavata/common/utils/AiravataUtils.java | 16 ++
modules/distribution/airavata-server/pom.xml | 5 +
.../src/main/assembly/bin-assembly.xml | 1 +
.../gfac/provider/impl/GSISSHProvider.java | 9 +-
.../server/OrchestratorServerHandler.java | 20 +-
.../src/test/resources/registry-derby.sql | 15 +-
.../persistance/registry/jpa/ResourceType.java | 1 +
.../registry/jpa/impl/ExperimentRegistry.java | 113 +++++----
.../registry/jpa/impl/ProjectRegistry.java | 211 ++++++++++++++++
.../registry/jpa/impl/RegistryImpl.java | 30 ++-
.../persistance/registry/jpa/model/Project.java | 23 ++
.../registry/jpa/model/ProjectUser.java | 77 ++++++
.../registry/jpa/model/ProjectUser_PK.java | 62 +++++
.../jpa/resources/AbstractResource.java | 7 +
.../jpa/resources/ExperimentResource.java | 4 +-
.../registry/jpa/resources/ProjectResource.java | 87 ++++++-
.../jpa/resources/ProjectUserResource.java | 109 ++++++++
.../jpa/resources/TaskDetailResource.java | 2 +-
.../registry/jpa/resources/Utils.java | 18 ++
.../jpa/utils/ThriftDataModelConversion.java | 28 ++-
.../src/main/resources/META-INF/persistence.xml | 1 +
.../src/main/resources/registry-derby.sql | 13 +-
.../src/main/resources/registry-mysql.sql | 13 +-
.../src/test/resources/registry-derby.sql | 13 +-
.../airavata/registry/cpi/utils/Constants.java | 5 +
.../gsi/ssh/api/job/SlurmJobConfiguration.java | 2 +-
.../gsi/ssh/api/job/SlurmOutputParser.java | 5 +-
73 files changed, 2926 insertions(+), 121 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/f9b95c93/modules/distribution/airavata-server/src/main/assembly/bin-assembly.xml
----------------------------------------------------------------------
[4/4] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/airavata
Posted by sa...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/airavata
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/13c67c46
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/13c67c46
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/13c67c46
Branch: refs/heads/master
Commit: 13c67c460409df04edba83704e6ee50bd51bffd3
Parents: 9b4dedf 4a0571d
Author: Saminda Wijeratne <sa...@gmail.com>
Authored: Wed Mar 12 10:24:32 2014 -0400
Committer: Saminda Wijeratne <sa...@gmail.com>
Committed: Wed Mar 12 10:24:32 2014 -0400
----------------------------------------------------------------------
.../airavata/client/tools/DocumentCreator.java | 2 +-
.../apache/airavata/job/monitor/MonitorID.java | 4 ++-
.../monitor/impl/pull/qstat/QstatMonitor.java | 13 ++++++++-
.../impl/pull/qstat/ResourceConnection.java | 8 ++++++
.../impl/push/amqp/UnRegisterThread.java | 3 +-
.../src/main/resources/conf/log4j.properties | 2 +-
.../gfac/provider/impl/GSISSHProvider.java | 4 ++-
.../registry/jpa/impl/AiravataJPARegistry.java | 5 ++--
.../registry/jpa/impl/ExperimentRegistry.java | 20 ++++++++------
.../jpa/resources/ErrorDetailResource.java | 1 +
.../apache/airavata/gsi/ssh/api/Cluster.java | 6 ++++
.../gsi/ssh/api/job/PBSOutputParser.java | 29 ++++++++++++++++----
.../gsi/ssh/api/job/SlurmOutputParser.java | 6 ++--
.../gsi/ssh/impl/GSISSHAbstractCluster.java | 5 +++-
14 files changed, 81 insertions(+), 27 deletions(-)
----------------------------------------------------------------------