public AbstractMongoConfigBuilder() throws IOException { timeout().setDefault(new Timeout()); net().setDefault(new Net()); cmdOptions().setDefault(new MongoCmdOptionsBuilder().build()); username().setDefault(""); password().setDefault(""); dbName().setDefault(""); stopTimeout().setDefault(TimeUnit.SECONDS.toMillis(5)); }
@Override protected final void onAfterProcessStart(ProcessControl process, IRuntimeConfig runtimeConfig) throws IOException { ProcessOutput outputConfig = runtimeConfig.getProcessOutput(); LogWatchStreamProcessor logWatch = new LogWatchStreamProcessor(successMessage(), knownFailureMessages(), StreamToLineProcessor.wrap(outputConfig.getOutput())); Processors.connect(process.getReader(), logWatch); Processors.connect(process.getError(), StreamToLineProcessor.wrap(outputConfig.getError())); logWatch.waitForResult(getConfig().timeout().getStartupTimeout()); if (logWatch.isInitWithSuccess()) { setProcessId(Mongod.getMongodProcessId(logWatch.getOutput(), -1)); } else { String failureFound = logWatch.getFailureFound(); if (failureFound==null) { failureFound="\n" + "----------------------\n" + "Hmm.. no failure message.. \n" + "...the cause must be somewhere in the process output\n" + "----------------------\n" + ""+logWatch.getOutput(); } try { // Process could be finished with success here! In this case no need to throw an exception! if(process.waitFor() != 0){ throw new IOException("Could not start process: "+failureFound); } } catch (InterruptedException e) { throw new IOException("Could not start process: "+failureFound, e); } } }
.importFile(importData.getFile()) .jsonArray(true) .timeout(new Timeout(importData.getTimeout())) .build();
.importFile(importData.getFile()) .jsonArray(true) .timeout(new Timeout(importData.getTimeout())) .build();