mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-19 14:15:50 +02:00
fix for 149785. Adding additional daemon argument to support server port range.
This commit is contained in:
parent
6232a59826
commit
5d4a23fa3b
4 changed files with 95 additions and 40 deletions
|
@ -205,6 +205,12 @@ public class ServerLauncher extends Thread
|
||||||
_port = "0";
|
_port = "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (_serverPortRange != null && (_port == null || _port.equals("0")))
|
||||||
|
{
|
||||||
|
_port = _serverPortRange;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// start new server
|
// start new server
|
||||||
try
|
try
|
||||||
|
@ -367,6 +373,7 @@ public class ServerLauncher extends Thread
|
||||||
private ServerSocket _serverSocket;
|
private ServerSocket _serverSocket;
|
||||||
private String _path;
|
private String _path;
|
||||||
private ArrayList _connections;
|
private ArrayList _connections;
|
||||||
|
private String _serverPortRange;
|
||||||
private ISSLProperties _sslProperties;
|
private ISSLProperties _sslProperties;
|
||||||
|
|
||||||
|
|
||||||
|
@ -409,6 +416,28 @@ public class ServerLauncher extends Thread
|
||||||
_connections = new ArrayList();
|
_connections = new ArrayList();
|
||||||
init(portStr);
|
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()
|
private String getKeyStoreLocation()
|
||||||
{
|
{
|
||||||
|
@ -612,10 +641,16 @@ public class ServerLauncher extends Thread
|
||||||
* Entry point into the DataStore daemon
|
* 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.
|
* @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[])
|
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]);
|
ServerLauncher theServer = new ServerLauncher(args[0]);
|
||||||
theServer.start();
|
theServer.start();
|
||||||
|
|
|
@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port;
|
||||||
if ($isHelp == 0)
|
if ($isHelp == 0)
|
||||||
{
|
{
|
||||||
print("command usage:\n");
|
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;
|
0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -25,10 +25,9 @@ else
|
||||||
|
|
||||||
if ($match != 0)
|
if ($match != 0)
|
||||||
{
|
{
|
||||||
print("To run the server daemon, you must be root\n");
|
print("WARNING: To run the server daemon, you must have root authority\n");
|
||||||
0;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$dir= $ENV{PWD};
|
$dir= $ENV{PWD};
|
||||||
$plugins_dir=$dir;
|
$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";
|
$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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ $isHelp = $helpFlag cmp $port;
|
||||||
if ($isHelp == 0)
|
if ($isHelp == 0)
|
||||||
{
|
{
|
||||||
print("command usage:\n");
|
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;
|
0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -25,10 +25,9 @@ else
|
||||||
|
|
||||||
if ($match != 0)
|
if ($match != 0)
|
||||||
{
|
{
|
||||||
print("To run the server daemon, you must be root\n");
|
print("WARNING: To run the server daemon, you must have root authority\n");
|
||||||
0;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$dir= $ENV{PWD};
|
$dir= $ENV{PWD};
|
||||||
$plugins_dir=$dir;
|
$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";
|
$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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,50 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
|
||||||
|
$port = "4035";
|
||||||
|
$helpFlag = "-h";
|
||||||
|
|
||||||
if (defined($ARGV[0]))
|
if (defined($ARGV[0]))
|
||||||
{
|
{
|
||||||
$port = $ARGV[0];
|
$port = $ARGV[0];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
$isHelp = $helpFlag cmp $port;
|
||||||
|
if ($isHelp == 0)
|
||||||
{
|
{
|
||||||
$port = "4035";
|
print("command usage:\n");
|
||||||
}
|
print("daemon.linux [<port> | <low port>-<high port>] [ <low server port>-<high server port>]\n");
|
||||||
|
0;
|
||||||
#$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;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dir= $ENV{PWD};
|
$trace = $ENV{DSTORE_TRACING_ON};
|
||||||
|
$user=`whoami`; chomp($user);
|
||||||
$plugins_dir=$dir;
|
$match = $user cmp "root";
|
||||||
|
|
||||||
$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";
|
|
||||||
|
|
||||||
|
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");
|
$oldClasspath = $ENV{CLASSPATH};
|
||||||
$ENV{CLASSPATH}=$oldClasspath;
|
|
||||||
|
$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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue