use of org.voltdb.utils.CommandLine in project voltdb by VoltDB.
the class LocalCluster method initLocalServer.
void initLocalServer(int hostId, boolean clearLocalDataDirectories) throws IOException {
// Make the local Configuration object...
CommandLine cmdln = (templateCmdLine.makeCopy());
cmdln.startCommand(StartAction.INITIALIZE);
cmdln.setJavaProperty(clusterHostIdProperty, String.valueOf(hostId));
if (this.m_additionalProcessEnv != null) {
for (String name : this.m_additionalProcessEnv.keySet()) {
cmdln.setJavaProperty(name, this.m_additionalProcessEnv.get(name));
}
}
if (new Integer(hostId).equals(m_mismatchNode)) {
assert m_usesStagedSchema;
cmdln.m_userSchema = m_mismatchSchema == null ? null : VoltProjectBuilder.createFileForSchema(m_mismatchSchema);
}
cmdln.setForceVoltdbCreate(clearLocalDataDirectories);
//If we are initializing lets wait for it to finish.
ServerThread th = new ServerThread(cmdln);
File root = VoltFile.getServerSpecificRoot(String.valueOf(hostId), clearLocalDataDirectories);
assert (root.getName().equals(Constants.DBROOT) == false) : root.getAbsolutePath();
cmdln.voltdbRoot(new File(root, Constants.DBROOT));
try {
th.initialize();
} catch (VoltDB.SimulatedExitException expected) {
//All ok
} catch (Exception ex) {
log.error("Failed to initialize cluster process:" + ex.getMessage(), ex);
assert (false);
}
//Keep track by hostid the voltdbroot
String hostIdStr = cmdln.getJavaProperty(clusterHostIdProperty);
m_hostRoots.put(hostIdStr, root.getAbsolutePath());
}
use of org.voltdb.utils.CommandLine in project voltdb by VoltDB.
the class LocalCluster method getListenerAddresses.
@Override
public List<String> getListenerAddresses() {
if (!m_running) {
return null;
}
ArrayList<String> listeners = new ArrayList<>();
for (int i = 0; i < m_cmdLines.size(); i++) {
CommandLine cl = m_cmdLines.get(i);
Process p = m_cluster.get(i);
// if the process is alive, or is the in-process server
if ((p != null) || (i == 0 && m_hasLocalServer)) {
listeners.add("localhost:" + cl.m_port);
}
}
return listeners;
}
use of org.voltdb.utils.CommandLine in project voltdb by VoltDB.
the class LocalCluster method getListenerAddress.
private String getListenerAddress(int hostId, boolean useAdmin) {
if (!m_running) {
return null;
}
for (int i = 0; i < m_cmdLines.size(); i++) {
CommandLine cl = m_cmdLines.get(i);
String hostIdStr = cl.getJavaProperty(clusterHostIdProperty);
if (hostIdStr.equals(String.valueOf(hostId))) {
Process p = m_cluster.get(i);
// if the process is alive, or is the in-process server
if ((p != null) || (i == 0 && m_hasLocalServer)) {
return "localhost:" + (useAdmin ? cl.m_adminPort : cl.m_port);
}
}
}
return null;
}
Aggregations