use of org.eclipse.jetty.util.MultiException in project hadoop by apache.
the class HttpServer2 method stop.
/**
* stop the server
*/
public void stop() throws Exception {
MultiException exception = null;
for (ServerConnector c : listeners) {
try {
c.close();
} catch (Exception e) {
LOG.error("Error while stopping listener for webapp" + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
}
try {
// explicitly destroy the secret provider
secretProvider.destroy();
// clear & stop webAppContext attributes to avoid memory leaks.
webAppContext.clearAttributes();
webAppContext.stop();
} catch (Exception e) {
LOG.error("Error while stopping web app context for webapp " + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
try {
webServer.stop();
} catch (Exception e) {
LOG.error("Error while stopping web server for webapp " + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
if (exception != null) {
exception.ifExceptionThrow();
}
}
use of org.eclipse.jetty.util.MultiException in project hbase by apache.
the class HttpServer method stop.
/**
* stop the server
*/
public void stop() throws Exception {
MultiException exception = null;
for (ListenerInfo li : listeners) {
if (!li.isManaged) {
continue;
}
try {
li.listener.close();
} catch (Exception e) {
LOG.error("Error while stopping listener for webapp" + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
}
try {
// clear & stop webAppContext attributes to avoid memory leaks.
webAppContext.clearAttributes();
webAppContext.stop();
} catch (Exception e) {
LOG.error("Error while stopping web app context for webapp " + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
try {
webServer.stop();
} catch (Exception e) {
LOG.error("Error while stopping web server for webapp " + webAppContext.getDisplayName(), e);
exception = addMultiException(exception, e);
}
if (exception != null) {
exception.ifExceptionThrow();
}
}
use of org.eclipse.jetty.util.MultiException in project jetty.project by eclipse.
the class AnnotationParser method parse.
/**
* Parse classes in the supplied classloader.
* Only class files in jar files will be scanned.
*
* @param handlers the handlers to look for classes in
* @param loader the classloader for the classes
* @param visitParents if true, visit parent classloaders too
* @param nullInclusive if true, an empty pattern means all names match, if false, none match
* @throws Exception if unable to parse
*/
public void parse(final Set<? extends Handler> handlers, ClassLoader loader, boolean visitParents, boolean nullInclusive) throws Exception {
if (loader == null)
return;
if (!(loader instanceof URLClassLoader))
//can't extract classes?
return;
final MultiException me = new MultiException();
JarScanner scanner = new JarScanner() {
@Override
public void processEntry(URI jarUri, JarEntry entry) {
try {
parseJarEntry(handlers, Resource.newResource(jarUri), entry);
} catch (Exception e) {
me.add(new RuntimeException("Error parsing entry " + entry.getName() + " from jar " + jarUri, e));
}
}
};
scanner.scan(null, loader, nullInclusive, visitParents);
me.ifExceptionThrow();
}
use of org.eclipse.jetty.util.MultiException in project jetty.project by eclipse.
the class AnnotationParser method parse.
/**
* Parse classes in the supplied uris.
*
* @param handlers the handlers to look for classes in
* @param uris the uris for the jars
* @throws Exception if unable to parse
*/
public void parse(final Set<? extends Handler> handlers, final URI[] uris) throws Exception {
if (uris == null)
return;
MultiException me = new MultiException();
for (URI uri : uris) {
try {
parse(handlers, uri);
} catch (Exception e) {
me.add(new RuntimeException("Problem parsing classes from " + uri, e));
}
}
me.ifExceptionThrow();
}
use of org.eclipse.jetty.util.MultiException in project jetty.project by eclipse.
the class AnnotationParser method parseDir.
/**
* Parse all classes in a directory
*
* @param handlers the set of handlers to look for classes in
* @param dir the resource directory to look for classes
* @throws Exception if unable to parse
*/
protected void parseDir(Set<? extends Handler> handlers, Resource dir) throws Exception {
// skip dirs whose name start with . (ie hidden)
if (!dir.isDirectory() || !dir.exists() || dir.getName().startsWith("."))
return;
if (LOG.isDebugEnabled()) {
LOG.debug("Scanning dir {}", dir);
}
;
MultiException me = new MultiException();
String[] files = dir.list();
for (int f = 0; files != null && f < files.length; f++) {
Resource res = dir.addPath(files[f]);
if (res.isDirectory())
parseDir(handlers, res);
else {
//we've already verified the directories, so just verify the class file name
File file = res.getFile();
if (isValidClassFileName((file == null ? null : file.getName()))) {
try {
String name = res.getName();
if (!isParsed(name)) {
Resource r = Resource.newResource(res.getURL());
if (LOG.isDebugEnabled()) {
LOG.debug("Scanning class {}", r);
}
;
try (InputStream is = r.getInputStream()) {
scanClass(handlers, dir, is);
}
}
} catch (Exception ex) {
if (LOG.isDebugEnabled())
LOG.debug("Error scanning file " + files[f], ex);
me.add(new RuntimeException("Error scanning file " + files[f], ex));
}
} else {
if (LOG.isDebugEnabled())
LOG.debug("Skipping scan on invalid file {}", res);
}
}
}
me.ifExceptionThrow();
}
Aggregations