1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +02:00

fix for 149785. Adding additional daemon argument to support server port range.

This commit is contained in:
David McKnight 2006-08-16 15:22:09 +00:00
parent 6232a59826
commit 5d4a23fa3b
4 changed files with 95 additions and 40 deletions

View file

@ -205,6 +205,12 @@ public class ServerLauncher extends Thread
_port = "0";
}
if (_serverPortRange != null && (_port == null || _port.equals("0")))
{
_port = _serverPortRange;
}
{
// start new server
try
@ -367,6 +373,7 @@ public class ServerLauncher extends Thread
private ServerSocket _serverSocket;
private String _path;
private ArrayList _connections;
private String _serverPortRange;
private ISSLProperties _sslProperties;
@ -409,6 +416,28 @@ public class ServerLauncher extends Thread
_connections = new ArrayList();
init(portStr);
}
/**
* Constructor
* @param portStr the port for the daemon socket to run on
* @param serverPortRange the port range for launched servers
*/
public ServerLauncher(String portStr, String serverPortRange)
{
String pluginPath = System.getProperty("A_PLUGIN_PATH");
if (pluginPath == null)
{
System.out.println("A_PLUGIN_PATH is not defined");
System.exit(-1);
}
_path = pluginPath.trim();
_serverPortRange = serverPortRange;
_connections = new ArrayList();
init(portStr);
}
private String getKeyStoreLocation()
{
@ -612,10 +641,16 @@ public class ServerLauncher extends Thread
* Entry point into the DataStore daemon
*
* @param args the port for the daemon to run on (default is 4035). Optionally, the second arg specifies whether to use SSL or not.
* an optional second arg can be used to specify the port range of servers that get launched
*/
public static void main(String args[])
{
if (args.length > 0)
if (args.length == 2)
{
ServerLauncher theServer = new ServerLauncher(args[0], args[1]);
theServer.start();
}
else if (args.length == 1)
{
ServerLauncher theServer = new ServerLauncher(args[0]);
theServer.start();

View file

@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port;
if ($isHelp == 0)
{
print("command usage:\n");
print("daemon.linux [<port> | <low port>-<high port>]\n");
print("daemon.linux [<port> | <low port>-<high port>] [ <low server port>-<high server port>]\n");
0;
}
else
@ -25,10 +25,9 @@ else
if ($match != 0)
{
print("To run the server daemon, you must be root\n");
0;
print("WARNING: To run the server daemon, you must have root authority\n");
}
else
{
$dir= $ENV{PWD};
$plugins_dir=$dir;
@ -39,6 +38,13 @@ else
$ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath";
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
if (defined($ARGV[1]))
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]");
}
else
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
}
}
}

View file

@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port;
if ($isHelp == 0)
{
print("command usage:\n");
print("daemon.linux [<port> | <low port>-<high port>]\n");
print("daemon.linux [<port> | <low port>-<high port>] [ <low server port>-<high server port>]\n");
0;
}
else
@ -25,10 +25,9 @@ else
if ($match != 0)
{
print("To run the server daemon, you must be root\n");
0;
print("WARNING: To run the server daemon, you must have root authority\n");
}
else
{
$dir= $ENV{PWD};
$plugins_dir=$dir;
@ -39,6 +38,13 @@ else
$ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath";
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
if (defined($ARGV[1]))
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]");
}
else
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
}
}
}

View file

@ -1,42 +1,50 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
$port = "4035";
$helpFlag = "-h";
if (defined($ARGV[0]))
{
{
$port = $ARGV[0];
}
else
$isHelp = $helpFlag cmp $port;
if ($isHelp == 0)
{
$port = "4035";
}
#$user = $ENV{USER};
$trace = $ENV{DSTORE_TRACING_ON};
$user=`whoami`; chomp($user);
$match = $user cmp "root";
if ($match != 0)
{
print("To run the server daemon, you must be root\n");
0;
print("command usage:\n");
print("daemon.linux [<port> | <low port>-<high port>] [ <low server port>-<high server port>]\n");
0;
}
else
{
$dir= $ENV{PWD};
$plugins_dir=$dir;
$ENV{A_PLUGIN_PATH}="$plugins_dir/";
$oldClasspath = $ENV{CLASSPATH};
$ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath";
$trace = $ENV{DSTORE_TRACING_ON};
$user=`whoami`; chomp($user);
$match = $user cmp "root";
if ($match != 0)
{
print("WARNING: To run the server daemon, you must have root authority\n");
}
{
$dir= $ENV{PWD};
$plugins_dir=$dir;
$ENV{A_PLUGIN_PATH}="$plugins_dir/";
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
$ENV{CLASSPATH}=$oldClasspath;
$oldClasspath = $ENV{CLASSPATH};
$ENV{"CLASSPATH"}="$plugins_dir:$plugins_dir/dstore_extra_server.jar:$plugins_dir/dstore_core.jar:$plugins_dir/dstore_miners.jar:$plugins_dir/clientserver.jar:$oldClasspath";
if (defined($ARGV[1]))
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port $ARGV[1]");
}
else
{
system("java -DA_PLUGIN_PATH=\$A_PLUGIN_PATH -DDSTORE_TRACING_ON=$trace org.eclipse.dstore.core.server.ServerLauncher $port");
}
}
}