You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/05/15 15:26:43 UTC
svn commit: r1338693 -
/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
Author: rmannibucau
Date: Tue May 15 13:26:43 2012
New Revision: 1338693
URL: http://svn.apache.org/viewvc?rev=1338693&view=rev
Log:
host is not always localhost so make it configurable
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java?rev=1338693&r1=1338692&r2=1338693&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/config/RemoteServer.java Tue May 15 13:26:43 2012
@@ -53,6 +53,7 @@ public class RemoteServer {
private final int tries;
private final boolean verbose;
private final int shutdownPort;
+ private final String host;
public RemoteServer() {
this(options.get("connect.tries", 60), options.get("verbose", false));
@@ -65,6 +66,7 @@ public class RemoteServer {
tomcat = (home != null) && (new File(new File(home, "bin"), "catalina.sh").exists());
shutdownPort = options.get("server.shutdown.port", tomcat ? 8005 : 4200);
+ host = options.get("server.shutdown.host", "localhost");
}
public void init(Properties props) {
@@ -326,8 +328,11 @@ public class RemoteServer {
System.out.println("lib dir doesn't exist");
return;
}
- for (File lib : dir.listFiles()) {
- System.out.println(lib.getAbsolutePath());
+ final File[] files = dir.listFiles();
+ if (files != null) {
+ for (File lib : files) {
+ System.out.println(lib.getAbsolutePath());
+ }
}
}
@@ -360,7 +365,7 @@ public class RemoteServer {
String command = "SHUTDOWN" + Character.toString((char) 0); // SHUTDOWN + EOF
- Socket socket = new Socket("localhost", shutdownPort);
+ Socket socket = new Socket(host, shutdownPort);
OutputStream out = socket.getOutputStream();
out.write(command.getBytes());
@@ -383,7 +388,7 @@ public class RemoteServer {
//System.out.println("CONNECT "+ tries);
try {
- Socket socket = new Socket("localhost", shutdownPort);
+ Socket socket = new Socket(host, shutdownPort);
OutputStream out = socket.getOutputStream();
out.close();
if (verbose) System.out.println("[] CONNECTED IN " + (this.tries - tries));