Example usage for com.google.common.collect ImmutableList toString

List of usage examples for com.google.common.collect ImmutableList toString

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.thelq.pircbotx.keepalive.JenkinsKeepAlive.java

public static void create() {
    Preconditions.checkState(!created, "Already created");
    created = true;/*from w ww .ja  va 2s  . c o m*/
    ImmutableList.Builder<String> jenkinsBotsBuilder = ImmutableList.builder();
    for (int i = 1;; i++) {

        String value = "";
        if (value == null)
            break;
        jenkinsBotsBuilder.add(value);
    }

    ImmutableList<String> jenkinsBots = jenkinsBotsBuilder.build();
    if (jenkinsBots.size() == 0)
        throw new RuntimeException("No jenkins bots setup!");
    log.info("Created jenkins keep alive for " + jenkinsBots.toString());
    KeepAlive.getExecutor().scheduleAtFixedRate(new JenkinsRunner(jenkinsBots), 0, 15, TimeUnit.MINUTES);
}

From source file:org.commoncrawl.mapred.ec2.parser.EC2ParserTask.java

private static void parse(FileSystem fs, Configuration conf, ImmutableList<Path> paths) throws IOException {
    LOG.info("Need to Parse:" + paths.toString());
    // create output path 
    long segmentId = System.currentTimeMillis();

    String segmentPathPrefix = conf.get(SEGMENT_PATH_PROPERTY);

    Path outputPath = new Path(S3N_BUCKET_PREFIX + segmentPathPrefix + Long.toString(segmentId));
    LOG.info("Starting Map-Reduce Job. SegmentId:" + segmentId + " OutputPath:" + outputPath);
    // run job...
    JobConf jobConf = new JobBuilder("parse job", conf)

            .inputs(paths).inputFormat(SequenceFileInputFormat.class).keyValue(Text.class, ParseOutput.class)
            .mapRunner(ParserMapRunner.class).mapper(ParserMapper.class)
            // allow two attempts to process the split 
            // after that, we will pick it up in post processing step 
            .maxMapAttempts(2).maxMapTaskFailures(1000).speculativeExecution(true).numReducers(0)
            .outputFormat(ParserOutputFormat.class).output(outputPath).minSplitSize(134217728 * 4)
            .reuseJVM(1000).build();/* w  w  w. jav  a  2 s . c o m*/

    Path jobLogsPath = new Path(
            S3N_BUCKET_PREFIX + conf.get(JOB_LOGS_PATH_PROPERTY) + Long.toString(segmentId));

    jobConf.set("hadoop.job.history.user.location", jobLogsPath.toString());
    jobConf.set("fs.default.name", S3N_BUCKET_PREFIX);
    jobConf.setLong("cc.segmet.id", segmentId);
    // set task timeout to 20 minutes 
    jobConf.setInt("mapred.task.timeout", 20 * 60 * 1000);
    // set mapper runtime to max 45 minutes .....  
    jobConf.setLong(ParserMapper.MAX_MAPPER_RUNTIME_PROPERTY, 45 * 60 * 1000);

    jobConf.setOutputCommitter(OutputCommitter.class);
    // allow lots of failures per tracker per job 
    jobConf.setMaxTaskFailuresPerTracker(Integer.MAX_VALUE);

    initializeTaskDataAwareJob(jobConf, segmentId);

    JobClient.runJob(jobConf);

    LOG.info("Job Finished. Writing Segments Manifest Files");
    writeSegmentManifestFile(fs, conf, segmentId, paths);

    String validSegmentPathPrefix = conf.get(VALID_SEGMENTS_PATH_PROPERTY);

    Path manifestOutputPath = new Path(validSegmentPathPrefix + Long.toString(segmentId));

    fs.mkdirs(manifestOutputPath);

    finalizeJob(fs, conf, jobConf, manifestOutputPath, segmentId);
}

From source file:codetoanalyze.java.infer.NullPointerExceptions.java

static void ReturnedValueOfImmutableListOf() {
    ImmutableList<Object> l = ImmutableList.of();
    if (l == null) {
        l.toString();
    }//from   w w w .  j  ava2 s  . c om
}

From source file:com.spectralogic.ds3autogen.net.generators.clientmodels.BaseClientGenerator.java

/**
 * Gets the value of the HttpStatusCode associated with the void response type.
 * code > 300: empty string (error)/*from w  w  w  .  ja va  2  s.c om*/
 * code == 204: HttpStatusCode.NoContent
 * Else: HttpStatusCode.OK
 */
protected static String getHttpStatusCode(final ImmutableList<Ds3ResponseCode> responseCodes) {
    if (isEmpty(responseCodes)) {
        LOG.error("There are no response codes");
        return "";
    }
    final ImmutableList<Integer> codes = responseCodes.stream()
            .filter(responseCode -> ResponsePayloadUtil.isNonErrorCode(responseCode.getCode()))
            .map(Ds3ResponseCode::getCode).collect(GuavaCollectors.immutableList());
    if (isEmpty(codes)) {
        LOG.error("There are no non-error response codes within the list: " + codes.toString());
        return "";
    }
    if (codes.contains(204)) {
        return "NoContent";
    }
    return "OK";
}

From source file:com.spectralogic.ds3autogen.utils.Ds3ElementUtil.java

/**
 * Gets the Xml tag name for an element from its list of Ds3Annotations, if one
 * exists. If multiple Xml tag names are found, an exception is thrown.
 */// ww w .  j  av  a2 s  .co  m
protected static String getXmlTagFromAllAnnotations(final ImmutableList<Ds3Annotation> annotations,
        final String elementName) {
    if (isEmpty(annotations)) {
        return "";
    }
    final ImmutableList.Builder<String> builder = ImmutableList.builder();
    for (final Ds3Annotation annotation : annotations) {
        final String curXmlName = getXmlTagFromAnnotation(annotation);
        if (hasContent(curXmlName)) {
            builder.add(curXmlName);
        }
    }
    final ImmutableList<String> xmlNames = builder.build();
    switch (xmlNames.size()) {
    case 0:
        return "";
    case 1:
        return xmlNames.get(0);
    default:
        throw new IllegalArgumentException(
                "There are multiple xml tag names described within the annotations for the element "
                        + elementName + ": " + xmlNames.toString());
    }
}

From source file:org.jclouds.route53.InvalidChangeBatchException.java

public InvalidChangeBatchException(ImmutableList<String> messages, HttpResponseException cause) {
    super(messages.toString(), cause);
    this.messages = messages;
}

From source file:com.facebook.buck.apple.simulator.AppleSimulatorController.java

/**
 * Installs a bundle in a previously-started simulator.
 *
 * @return true if the bundle was installed, false otherwise.
 *///from w w w .  j a  va  2s .c o  m
public boolean installBundleInSimulator(String simulatorUdid, Path bundlePath)
        throws IOException, InterruptedException {
    ImmutableList<String> command = ImmutableList.of(simctlPath.toString(), "install", simulatorUdid,
            bundlePath.toString());
    ProcessExecutorParams processExecutorParams = ProcessExecutorParams.builder().setCommand(command).build();
    ProcessExecutor.Result result = processExecutor.launchAndExecute(processExecutorParams);
    if (result.getExitCode() != 0) {
        LOG.error(result.getMessageForUnexpectedResult(command.toString()));
        return false;
    }
    return true;
}

From source file:com.facebook.buck.apple.simulator.AppleSimulatorController.java

private boolean launchSimulatorWithUdid(Path iosSimulatorPath, String simulatorUdid)
        throws IOException, InterruptedException {
    ImmutableList<String> command = ImmutableList.of("open", "-a", iosSimulatorPath.toString(), "--args",
            "-CurrentDeviceUDID", simulatorUdid);
    LOG.debug("Launching iOS simulator %s: %s", simulatorUdid, command);
    ProcessExecutorParams processExecutorParams = ProcessExecutorParams.builder().setCommand(command).build();
    ProcessExecutor.Result result = processExecutor.launchAndExecute(processExecutorParams);
    if (result.getExitCode() != 0) {
        LOG.error(result.getMessageForUnexpectedResult(command.toString()));
        return false;
    }/*from   ww  w.  j a va 2 s.c om*/
    return true;
}

From source file:com.github.caofangkun.bazelipse.command.Command.java

private Command(String consoleName, File directory, ImmutableList<String> args,
        Function<String, String> stdoutSelector, Function<String, String> stderrSelector, OutputStream stdout,
        OutputStream stderr) throws IOException {
    this.directory = directory;
    this.args = args;
    if (consoleName != null) {
        MessageConsole console = findConsole(consoleName);
        MessageConsoleStream stream = console.newMessageStream();
        stream.setActivateOnWrite(true);
        stream.write(// w w  w .ja  v a 2  s . c o m
                "*** Running " + String.join("", args.toString()) + " from " + directory.toString() + " ***\n");
        if (stdout == null) {
            stdout = console.newMessageStream();
        }
        if (stderr == null) {
            stderr = getErrorStream(console);
        }
    }
    this.stderr = new SelectOutputStream(stderr, stderrSelector);
    this.stdout = new SelectOutputStream(stdout, stdoutSelector);
}

From source file:com.facebook.buck.apple.simulator.AppleCoreSimulatorServiceController.java

private boolean killService(String serviceName) throws IOException, InterruptedException {
    ImmutableList<String> launchctlRemoveCommand = ImmutableList.of("launchctl", "remove", serviceName);
    LOG.debug("Killing simulator process with with %s", launchctlRemoveCommand);
    ProcessExecutorParams launchctlRemoveParams = ProcessExecutorParams.builder()
            .setCommand(launchctlRemoveCommand).build();
    ProcessExecutor.Result result = processExecutor.launchAndExecute(launchctlRemoveParams);
    int launchctlExitCode = result.getExitCode();
    LOG.debug("Command %s exited with code %d", launchctlRemoveParams, launchctlExitCode);
    switch (launchctlExitCode) {
    case LAUNCHCTL_EXIT_SUCCESS:
    case LAUNCHCTL_EXIT_NO_SUCH_PROCESS:
        // The process could have exited by itself or already been terminated by the time
        // we told it to die, so we have to treat "no such process" as success.
        return true;
    default:/*  ww  w.j ava 2  s.com*/
        LOG.error(result.getMessageForUnexpectedResult(launchctlRemoveCommand.toString()));
        return false;
    }
}