You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by ps...@apache.org on 2012/01/12 12:21:17 UTC
svn commit: r1230493 - in
/incubator/wookie/trunk/src/org/apache/wookie/server: Start.java Stop.java
Author: psharples
Date: Thu Jan 12 11:21:16 2012
New Revision: 1230493
URL: http://svn.apache.org/viewvc?rev=1230493&view=rev
Log:
Fix to allow two instances (jetty/derby standalone version) of wookie to run on same machine. See WOOKIE-284.
Modified:
incubator/wookie/trunk/src/org/apache/wookie/server/Start.java
incubator/wookie/trunk/src/org/apache/wookie/server/Stop.java
Modified: incubator/wookie/trunk/src/org/apache/wookie/server/Start.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/server/Start.java?rev=1230493&r1=1230492&r2=1230493&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/server/Start.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/server/Start.java Thu Jan 12 11:21:16 2012
@@ -31,6 +31,7 @@ import org.mortbay.jetty.webapp.WebAppCo
public class Start {
static final private Logger logger = Logger.getLogger(Start.class);
private static int port = 8080;
+ private static int shutdownPort = 8079;
public static final String PERSISTENCE_MANAGER_TYPE_PROPERTY_NAME = "wookie.persistence.manager.type";
public static final String PERSISTENCE_MANAGER_TYPE_JPA = "jpa";
@@ -43,13 +44,16 @@ public class Start {
boolean initDB = true;
for (int i = 0; i < args.length; i++) {
String arg = args[i];
- System.out.println("Runtime argument: " + arg);
+ logger.info("Runtime argument: " + arg);
if (arg.startsWith("port=")) {
port = new Integer(arg.substring(5));
+ } else if (arg.startsWith("shutdownport=")) {
+ shutdownPort = new Integer(arg.substring(13));
+ logger.info("Shutdown port set:to "+shutdownPort);
} else if (arg.startsWith("initDB=")) {
initDB = !arg.substring(7).toLowerCase().equals("false");
} else {
- System.out.println("argument UNRECOGNISED - ignoring");
+ logger.info("argument UNRECOGNISED - ignoring");
}
}
@@ -120,7 +124,7 @@ public class Start {
setDaemon(true);
setName("StopMonitor");
try {
- socket = new ServerSocket(8079, 1, InetAddress.getByName("127.0.0.1"));
+ socket = new ServerSocket(shutdownPort, 1, InetAddress.getByName("127.0.0.1"));
} catch(Exception e) {
throw new RuntimeException(e);
}
Modified: incubator/wookie/trunk/src/org/apache/wookie/server/Stop.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/server/Stop.java?rev=1230493&r1=1230492&r2=1230493&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/server/Stop.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/server/Stop.java Thu Jan 12 11:21:16 2012
@@ -18,12 +18,30 @@ import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
+import org.apache.log4j.Logger;
+
public class Stop {
+ static final private Logger logger = Logger.getLogger(Stop.class);
+ private static int shutdownPort = 8079;
+
public static void main(String[] args) throws Exception {
- Socket s = new Socket(InetAddress.getByName("127.0.0.1"), 8079);
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ logger.info("Runtime argument: " + arg);
+ if (arg.startsWith("shutdownport=")) {
+ try {
+ shutdownPort = new Integer(arg.substring(13));
+ } catch (Exception e) {
+ logger.error("Unable to parse shutdown port:" + arg.substring(13));
+ }
+ logger.info("The shutdown port is: "+shutdownPort);
+ break;
+ }
+ }
+ Socket s = new Socket(InetAddress.getByName("127.0.0.1"), shutdownPort);
OutputStream out = s.getOutputStream();
- System.out.println("*** sending jetty stop request");
+ logger.info("*** sending jetty stop request");
out.write(("\r\n").getBytes());
out.flush();
s.close();