Esempio n. 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Process run(int machineId, int clusterPort, int haPort, int initialHost1, int initialHost2) throws java.io.IOException
        private Process Run(int machineId, int clusterPort, int haPort, int initialHost1, int initialHost2)
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            IList <string> allArgs = new List <string>(Arrays.asList("java", "-cp", System.getProperty("java.class.path"), "-Djava.awt.headless=true", typeof(HardKillIT).FullName));

            allArgs.Add("" + machineId);
            allArgs.Add(Path(machineId).AbsolutePath);
            allArgs.Add(clusterPort.ToString());
            allArgs.Add(haPort.ToString());
            allArgs.Add(initialHost1.ToString());
            allArgs.Add(initialHost2.ToString());

            Process process = Runtime.Runtime.exec(allArgs.ToArray());

            _processHandler = new ProcessStreamHandler(process, false);
            _processHandler.launch();
            return(process);
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static int runBackupToolFromOtherJvmToGetExitCode(java.io.File neo4jHome, java.io.PrintStream outPrintStream, java.io.PrintStream errPrintStream, boolean debug, String... args) throws Exception
        public static int RunBackupToolFromOtherJvmToGetExitCode(File neo4jHome, PrintStream outPrintStream, PrintStream errPrintStream, bool debug, params string[] args)
        {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            IList <string> allArgs = new List <string>(Arrays.asList(JavaExecutable.ToString(), "-cp", ClassPath, typeof(AdminTool).FullName));

            allArgs.Add("backup");
            ((IList <string>)allArgs).AddRange(Arrays.asList(args));

            ProcessBuilder processBuilder = (new ProcessBuilder()).command(allArgs.ToArray());

            processBuilder.environment().put("NEO4J_HOME", neo4jHome.AbsolutePath);
            if (debug)
            {
                processBuilder.environment().put("NEO4J_DEBUG", "anything_works");
            }
            Process process = processBuilder.start();
            ProcessStreamHandler processStreamHandler = new ProcessStreamHandler(process, false, "", StreamConsumer.IGNORE_FAILURES, outPrintStream, errPrintStream);

            return(processStreamHandler.WaitForResult());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private boolean startArbiter(java.io.File configDir, java.util.concurrent.CountDownLatch latch) throws Exception
        private bool StartArbiter(File configDir, System.Threading.CountdownEvent latch)
        {
            Process process = null;
            ProcessStreamHandler handler = null;

            try
            {
                process = StartArbiterProcess(configDir);
                (new InputStreamAwaiter(process.InputStream)).awaitLine(ArbiterBootstrapperTestProxy.START_SIGNAL, 20, SECONDS);
                handler = new ProcessStreamHandler(process, false, "", IGNORE_FAILURES);
                handler.Launch();

                // Latch is triggered when the arbiter we just spawned joins the cluster,
                // or rather when the first client sees it as joined. If the latch awaiting times out it
                // (most likely) means that the arbiter couldn't be started. The reason for not
                // being able to start is assumed in this test to be that the specified port already is in use.
                return(latch.await(10, SECONDS));
            }
            finally
            {
                if (process != null)
                {
                    // Tell it to leave the cluster and shut down now
                    using (Stream inputToOtherProcess = process.OutputStream)
                    {
                        inputToOtherProcess.WriteByte(0);
                        inputToOtherProcess.Flush();
                    }
                    if (!process.waitFor(10, SECONDS))
                    {
                        Kill(process);
                    }
                }
                if (handler != null)
                {
                    handler.Done();
                }
            }
        }