Tabnine Logo
CompoundRuntimeException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.brooklyn.util.exceptions.CompoundRuntimeException
constructor

Best Java code snippets using org.apache.brooklyn.util.exceptions.CompoundRuntimeException.<init> (Showing top 13 results out of 315)

origin: org.apache.brooklyn/brooklyn-test-framework

  /**
   * @throws AssertionError if any failures were collected.
   */
  public void validate() {
    if (0 < failures.size()) {
      if (1 == failures.size()) {
        throw failures.get(0);
      }
      StringBuilder builder = new StringBuilder();
      for (AssertionError assertionError : failures) {
        builder.append(assertionError.getMessage()).append("\n");
      }
      throw new AssertionError("Assertions failed:\n" + builder, new CompoundRuntimeException("Assertions", failures));
    }
  }
}
origin: org.apache.brooklyn/brooklyn-utils-common

/** creates the given exception, but without propagating it, for use when caller will be wrapping */
public static RuntimeException create(@Nullable String prefix, Iterable<? extends Throwable> exceptions) {
  if (Iterables.size(exceptions)==1) {
    Throwable e = exceptions.iterator().next();
    if (Strings.isBlank(prefix)) return new PropagatedRuntimeException(e);
    return new PropagatedRuntimeException(prefix + ": " + Exceptions.collapseText(e), e);
  }
  if (Iterables.isEmpty(exceptions)) {
    if (Strings.isBlank(prefix)) return new CompoundRuntimeException("(empty compound exception)", exceptions);
    return new CompoundRuntimeException(prefix, exceptions);
  }
  if (Strings.isBlank(prefix)) return new CompoundRuntimeException(Iterables.size(exceptions)+" errors, including: " + Exceptions.collapseText(exceptions.iterator().next()), exceptions);
  return new CompoundRuntimeException(prefix+"; "+Iterables.size(exceptions)+" errors including: " + Exceptions.collapseText(exceptions.iterator().next()), exceptions);
}
origin: org.apache.brooklyn/brooklyn-core

public static void stopSequentially(Iterable<? extends Startable> entities) {
  List<Exception> exceptions = Lists.newArrayList();
  List<Startable> failedEntities = Lists.newArrayList();
  
  for (final Startable entity : entities) {
    if (!Entities.isManaged((Entity)entity)) {
      log.debug("Not stopping {} because it is not managed; continuing", entity);
      continue;
    }
    try {
      TaskAdaptable<Void> task = TaskTags.markInessential(Effectors.invocation((Entity)entity, Startable.STOP, Collections.emptyMap()));
      DynamicTasks.submit(task, (Entity)entity).getUnchecked();
    } catch (Exception e) {
      log.warn("Error stopping "+entity+"; continuing with shutdown", e);
      exceptions.add(e);
      failedEntities.add(entity);
    }
  }
  
  if (exceptions.size() > 0) {
    throw new CompoundRuntimeException("Error stopping "+(failedEntities.size() > 1 ? "entities" : "entity")+": "+failedEntities, exceptions);
  }
}
origin: org.apache.brooklyn/brooklyn-utils-common

  @Override
  @SuppressWarnings("unchecked")
  public <T> Maybe<T> tryCoerce(Object input, TypeToken<T> targetType) {
    Class<? super T> rawTargetType = targetType.getRawType();
    
    List<ClassCoercionException> exceptions = Lists.newArrayList();
    //now look for static TargetType.fromType(Type t) where value instanceof Type  
    for (Method m: rawTargetType.getMethods()) {
      if (((m.getModifiers()&Modifier.STATIC)==Modifier.STATIC) && 
          m.getName().startsWith("from") && m.getParameterTypes().length==1 &&
          m.getParameterTypes()[0].isInstance(input)) {
        if (m.getName().equals("from"+JavaClassNames.verySimpleClassName(m.getParameterTypes()[0]))) {
          try {
            return Maybe.of((T) m.invoke(null, input));
          } catch (Exception e) {
            exceptions.add(new ClassCoercionException("Cannot coerce type "+input.getClass()+" to "+rawTargetType.getCanonicalName()+" ("+input+"): "+m.getName()+" adapting failed", e));
          }
        }
      }
    }
    if (exceptions.isEmpty()) {
      return null;
    } else if (exceptions.size() == 1) {
      return Maybe.absent(exceptions.get(0));
    } else {
      String errMsg = "Failed coercing type "+input.getClass()+" to "+rawTargetType.getCanonicalName();
      return Maybe.absent(new CompoundRuntimeException(errMsg, exceptions));
    }
  }
}
origin: org.apache.brooklyn/brooklyn-core

String msg;
if (errors.size()>1) {
  wrapped = new CompoundRuntimeException(errors.size()+" sublocation exceptions, including: "+
    Exceptions.collapseText(errors.get(0)), errors);
  msg = Exceptions.collapseText(wrapped);
origin: org.apache.brooklyn/brooklyn-core

} else {
  throw new CompoundRuntimeException("Problem loading mementos ("+phase+")", exceptions);
origin: org.apache.brooklyn/brooklyn-locations-jclouds

@Override
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  List<Exception> exceptions = Lists.newArrayList();
  try {
    exceptions.addAll(releaseMachineSafely(machines));
    machines.clear();
  } finally {
    super.tearDown();
  }
  
  if (exceptions.size() > 0) {
    throw new CompoundRuntimeException("Error in tearDown of "+getClass(), exceptions);
  }
}
origin: org.apache.brooklyn/brooklyn-locations-jclouds

@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  List<Exception> exceptions = Lists.newArrayList();
  try {
    if (machines != null) {
      exceptions.addAll(releaseMachineSafely(machines));
      machines.clear();
    }
  } finally {
    try {
      if (managementContext != null) Entities.destroyAll(managementContext);
    } catch (Exception e) {
      LOG.warn("Error destroying management context", e);
      exceptions.add(e);
    }
    managementContext = null;
  }
  
  // TODO Debate about whether to:
  //  - use destroyAllCatching (i.e. not propagating exception)
  //    Benefit is that other tests in class will subsequently be run, rather than bailing out.
  //  - propagate exceptions from tearDown
  //    Benefit is that we don't hide errors; release(...) etc should not be throwing exceptions.
  if (exceptions.size() > 0) {
    throw new CompoundRuntimeException("Error in tearDown of "+getClass(), exceptions);
  }
}
origin: org.apache.brooklyn/brooklyn-locations-jclouds

@Override
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  List<Exception> exceptions = Lists.newArrayList();
  for (ManagementContext mgmt : mgmts) {
    try {
      if (mgmt.isRunning()) Entities.destroyAll(mgmt);
    } catch (Exception e) {
      LOG.warn("Error destroying management context", e);
      exceptions.add(e);
    }
  }
  mgmts.clear();
  origManagementContext = null;
  newManagementContext = null;
  origApp = null;
  newApp = null;
  
  super.tearDown();
  
  if (exceptions.size() > 0) {
    throw new CompoundRuntimeException("Error in tearDown of "+getClass(), exceptions);
  }
}
origin: org.apache.brooklyn/brooklyn-software-messaging

@Override
public void stop() {
  List<Exception> errors = Lists.newArrayList();
  if (getZooKeeper() != null && Objects.equal(this, getZooKeeper().getParent())) {
    try {
      getZooKeeper().stop();
    } catch (Exception e) {
      errors.add(e);
    }
  }
  if (getCurrentSize() > 0) {
    try {
      getCluster().stop();
    } catch (Exception e) {
      errors.add(e);
    }
  }
  clearLocations();
  sensors().set(SERVICE_UP, false);
  if (errors.size() != 0) {
    throw new CompoundRuntimeException("Error stopping Kafka cluster", errors);
  }
}
origin: org.apache.brooklyn/brooklyn-locations-jclouds

@Override
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  List<Exception> exceptions = Lists.newArrayList();
  try {
    if (provisioningManagementContext != null && provisionedMachine != null) {
      provisionedMachine.getParent().release(provisionedMachine);
    }
  } finally {
    Entities.destroyAll(provisioningManagementContext);
    provisioningManagementContext = null;
    provisionedMachine = null;
    
    super.tearDown();
  }
  
  if (exceptions.size() > 0) {
    throw new CompoundRuntimeException("Error in tearDown of "+getClass(), exceptions);
  }
}
origin: org.apache.brooklyn/brooklyn-locations-jclouds

@Override
@AfterMethod(alwaysRun=true)
public void tearDown() throws Exception {
  try {
    List<Exception> exceptions = Lists.newArrayList();
    for (ManagementContext mgmt : mgmts) {
      try {
        if (mgmt.isRunning()) Entities.destroyAll(mgmt);
      } catch (Exception e) {
        LOG.warn("Error destroying management context", e);
        exceptions.add(e);
      }
    }
    
    super.tearDown();
    
    if (exceptions.size() > 0) {
      throw new CompoundRuntimeException("Error in tearDown of "+getClass(), exceptions);
    }
  } finally {
    mgmts.clear();
    origManagementContext = null;
    newManagementContext = null;
    origApp = null;
    newApp = null;
    RecordingSshTool.clear();
    RecordingWinRmTool.clear();
  }
}
origin: org.apache.brooklyn/brooklyn-core

throw new CompoundRuntimeException("Aborted waiting for ready from "+source+" "+sensor, abortionExceptions);
  throw new CompoundRuntimeException("Aborted waiting for ready from "+source+" "+sensor, abortionExceptions);
    throw new CompoundRuntimeException("Aborted waiting for ready from "+source+" "+sensor, abortionExceptions);
org.apache.brooklyn.util.exceptionsCompoundRuntimeException<init>

Popular methods of CompoundRuntimeException

  • getAllCauses

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setContentView (Activity)
  • onCreateOptionsMenu (Activity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now