@Override public String readContent(String location) { try { return Resources.toString(new URL(ZkWorkItemRepositoryFactory.SCHEME + ":" + location), Charsets.UTF_8); } catch (Exception e) { throw FabricException.launderThrowable(e); } }
public static RuntimeException launderThrowable(Throwable cause) { if (cause instanceof RuntimeException) { return (RuntimeException) cause; } else if (cause instanceof Error) { throw (Error) cause; } else { return new FabricException(cause); } } }
/** * Destroy the given containers */ public static void destroy(FabricService fabricService, Set<Container> containers) { for (Container aux : containers) { String cntId = aux.getId(); try { fabricService.destroyContainer(cntId, true); } catch (Exception ex) { new FabricException("Cannot destroy container: " + cntId, ex).printStackTrace(System.err); } } }
throw new FabricException("Could not acquire port lock for pid " + pid); throw new FabricException("Could not find port within range [" + fromPort + "," + toPort + "] for pid " + pid); } catch (InterruptedException ex) { cleanUpDirtyZKNodes(interProcessLock); throw FabricException.launderThrowable(ex); } catch (Exception ex) { throw FabricException.launderThrowable(ex); } finally { releaseLock(lease);
destroyed = true; } else { throw new FabricException("Container's lifecycle not managed by Fabric8 (the container was not created by Fabric8)."); throw FabricException.launderThrowable(providerException);
/** * Stop the given containers. * The container directory will not get deleted. */ public static void stop(FabricService fabricService, Set<Container> containers) { for (Container aux : containers) { String cntId = aux.getId(); try { fabricService.stopContainer(cntId, true); } catch (Exception ex) { new FabricException("Cannot stop container: " + cntId, ex).printStackTrace(System.err); } } } }
@Override public String readContent(String location) { try { return Resources.toString(new URL(ProfileWorkItemRepositoryFactory.SCHME + ":" + location), Charsets.UTF_8); } catch (Exception e) { throw FabricException.launderThrowable(e); } }
throw new FabricException("Could not acquire port lock"); throw FabricException.launderThrowable(ex); } catch (Exception ex) { throw FabricException.launderThrowable(ex); } finally { if (existingLease == null) {
public static RuntimeException launderThrowable(Throwable cause) { if (cause instanceof RuntimeException) { return (RuntimeException) cause; } else if (cause instanceof Error) { throw (Error) cause; } else { return new FabricException(cause); } } }
private static String toString(Properties properties) { StringWriter writer = new StringWriter(); try { properties.store(writer, ""); } catch (IOException e) { throw FabricException.launderThrowable(e); } return writer.toString(); }
final ContainerProvider provider = getProvider(options.getProviderType()); if (provider == null) { throw new FabricException("Unable to find a container provider supporting '" + options.getProviderType() + "'"); throw new FabricException("The provider '" + options.getProviderType() + "' is not valid in current environment"); throw new FabricException("A name must be specified when creating containers"); throw new FabricException("Timeout waiting for container creation"); throw FabricException.launderThrowable(e);
public synchronized void close() { if (connector != null) { try { connector.close(); } catch (IOException e) { throw new FabricException("Failed to close connection: " + connector + " on " + this + ". " + e, e); } finally { connector = null; } } }
private static Properties mergeProperties(String left, Properties right) { Properties p = new Properties(); try { p.load(new StringReader(left)); } catch (IOException e) { throw FabricException.launderThrowable(e); } return mergeProperties(p, right); }
throw new FabricException("Could not acquire port lock"); throw FabricException.launderThrowable(ex); } catch (Exception ex) { throw FabricException.launderThrowable(ex); } finally { releaseLock(lease);
private static void addProperty(Object obj, String field, Map<String, Object> map) { try { Object prop = PropertyUtils.getProperty(obj, field); map.put(field, prop); } catch (Exception e) { throw new FabricException("Failed to initialize DTO", e); } }
@Override public synchronized void stop() { if (partitionCache != null) { try { partitionCache.close(); partitionCache = null; } catch (IOException e) { throw FabricException.launderThrowable(e); } } }
throw new FabricException("Could not acquire port lock for pid " + pid); throw FabricException.launderThrowable(ex); } catch (Exception ex) { throw FabricException.launderThrowable(ex); } finally { if (existingLease == null) {
@Override public List<String> getFields(String className) { try { return BeanUtils.getFields(Class.forName(className)); } catch (ClassNotFoundException e) { throw new FabricException("Failed to load class " + className, e); } }
@Override public boolean isEnsembleServer() { try { List<String> containers = dataStore.getEnsembleContainers(); for (String container : containers) { if (id.equals(container)) { return true; } } return false; } catch (Exception e) { throw FabricException.launderThrowable(e); } }