protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "hardware ids that didn't match: %s", transform(hardwares, hardwareToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "image ids that didn't match: %s", transform(images, imageToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "image ids that didn't match: %s", transform(images, imageToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "hardware ids that didn't match: %s", transform(hardwares, hardwareToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "image ids that didn't match: %s", transform(images, imageToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "hardware ids that didn't match: %s", transform(hardwares, hardwareToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingImageIds(String message, Iterable<? extends Image> images) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "image ids that didn't match: %s", transform(images, imageToId)); throw exception; }
protected NoSuchElementException throwNoSuchElementExceptionAfterLoggingHardwareIds(String message, Iterable<? extends Hardware> hardwares) { NoSuchElementException exception = new NoSuchElementException(message); if (logger.isTraceEnabled()) logger.warn(exception, "hardware ids that didn't match: %s", transform(hardwares, hardwareToId)); throw exception; }
@Override public Image apply(Iterable<? extends Image> input) { List<? extends Image> maxImages = multiMax(ordering, input); if (logger.isTraceEnabled()) logger.trace("<< best images(%s)", transform(maxImages, imageToId)); return maxImages.get(maxImages.size() - 1); } };
@Override public Image apply(Iterable<? extends Image> input) { List<? extends Image> maxImages = multiMax(ordering, input); if (logger.isTraceEnabled()) logger.trace("<< best images(%s)", transform(maxImages, imageToId)); return maxImages.get(maxImages.size() - 1); } };
@Override public Image apply(Iterable<? extends Image> input) { List<? extends Image> maxImages = multiMax(ordering, input); if (logger.isTraceEnabled()) logger.trace("<< best images(%s)", transform(maxImages, imageToId)); return maxImages.get(maxImages.size() - 1); } };
@Override public boolean apply(ReferenceType arg0) { // TODO: this is inefficient, calculating the index each time, but // shouldn't be added to constructor as the supplier is an expensive // call Map<URI, Catalog> index = catalogsByIdSupplier.get(); Catalog catalog = index.get(arg0.getHref()); if (catalog == null) { if (logger.isTraceEnabled()) logger.trace("didn't find catalog %s", arg0); return false; } else return !catalog.isReadOnly(); } }
@Override public boolean apply(ReferenceType arg0) { // TODO: this is inefficient, calculating the index each time, but // shouldn't be added to constructor as the supplier is an expensive // call Map<URI, Catalog> index = catalogsByIdSupplier.get(); Catalog catalog = index.get(arg0.getHref()); if (catalog == null) { if (logger.isTraceEnabled()) logger.trace("didn't find catalog %s", arg0); return false; } else return !catalog.isReadOnly(); } }
@Override public boolean apply(ReferenceType arg0) { // TODO: this is inefficient, calculating the index each time, but // shouldn't be added to constructor as the supplier is an expensive // call Map<URI, Catalog> index = catalogsByIdSupplier.get(); Catalog catalog = index.get(arg0.getHref()); if (catalog == null) { if (logger.isTraceEnabled()) logger.trace("didn't find catalog %s", arg0); return false; } else return !catalog.isReadOnly(); } }
public ExecResponse runAction(String action) { ExecResponse returnVal; String command = (runAsRoot && Predicates.in(ImmutableSet.of("start", "stop", "run")).apply(action)) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action); returnVal = runCommand(command); if (ImmutableSet.of("status", "stdout", "stderr").contains(action)) logger.trace("<< %s(%d)", action, returnVal.getExitStatus()); else if (computeLogger.isTraceEnabled()) computeLogger.trace("<< %s[%s]", action, returnVal); else computeLogger.debug("<< %s(%d)", action, returnVal.getExitStatus()); return returnVal; }
public ExecResponse runAction(String action) { ExecResponse returnVal; String command = (runAsRoot && Predicates.in(ImmutableSet.of("start", "stop", "run")).apply(action)) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action); returnVal = runCommand(command); if (ImmutableSet.of("status", "stdout", "stderr").contains(action)) logger.trace("<< %s(%d)", action, returnVal.getExitStatus()); else if (computeLogger.isTraceEnabled()) computeLogger.trace("<< %s[%s]", action, returnVal); else computeLogger.debug("<< %s(%d)", action, returnVal.getExitStatus()); return returnVal; }
public ExecResponse runAction(String action) { ExecResponse returnVal; String command = (runAsRoot && Predicates.in(ImmutableSet.of("start", "stop", "run")).apply(action)) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action); returnVal = runCommand(command); if (ImmutableSet.of("status", "stdout", "stderr").contains(action)) logger.trace("<< %s(%d)", action, returnVal.getExitStatus()); else if (computeLogger.isTraceEnabled()) computeLogger.trace("<< %s[%s]", action, returnVal); else computeLogger.debug("<< %s(%d)", action, returnVal.getExitStatus()); return returnVal; }
public ExecResponse runAction(String action) { ExecResponse returnVal; String command = (runAsRoot && Predicates.in(ImmutableSet.of("start", "stop", "run")).apply(action)) ? execScriptAsRoot(action) : execScriptAsDefaultUser(action); returnVal = runCommand(command); if (ImmutableSet.of("status", "stdout", "stderr").contains(action)) logger.trace("<< %s(%d)", action, returnVal.getExitStatus()); else if (computeLogger.isTraceEnabled()) computeLogger.trace("<< %s[%s]", action, returnVal); else computeLogger.debug("<< %s(%d)", action, returnVal.getExitStatus()); return returnVal; }
public T apply(HttpResponse from) { try { checkNotNull(from, "http response"); checkNotNull(from.getPayload(), "payload in " + from); } catch (NullPointerException e) { return addDetailsAndPropagate(from, e); } InputStream is = null; try { // debug is more normally set, so trace is more appropriate for // something heavy like this if (from.getStatusCode() >= 300 || logger.isTraceEnabled()) return convertStreamToStringAndParse(from); is = from.getPayload().getInput(); return parse(new InputSource(is)); } catch (RuntimeException e) { return addDetailsAndPropagate(from, e); } finally { Closeables.closeQuietly(is); from.getPayload().release(); } }
public T apply(HttpResponse from) { try { checkNotNull(from, "http response"); checkNotNull(from.getPayload(), "payload in " + from); } catch (NullPointerException e) { return addDetailsAndPropagate(from, e); } InputStream is = null; try { // debug is more normally set, so trace is more appropriate for // something heavy like this if (from.getStatusCode() >= 300 || logger.isTraceEnabled()) return convertStreamToStringAndParse(from); is = from.getPayload().getInput(); return parse(new InputSource(is)); } catch (RuntimeException e) { return addDetailsAndPropagate(from, e); } finally { Closeables.closeQuietly(is); from.getPayload().release(); } }