Example usage for org.springframework.context ApplicationContextException fillInStackTrace

List of usage examples for org.springframework.context ApplicationContextException fillInStackTrace

Introduction

In this page you can find the example usage for org.springframework.context ApplicationContextException fillInStackTrace.

Prototype

public synchronized Throwable fillInStackTrace() 

Source Link

Document

Fills in the execution stack trace.

Usage

From source file:org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.java

/**
 * Cancel waiting due to timeout.//from   w  w w  . jav a2 s.  c o m
 */
private void timeout() {
    ApplicationContextException e;
    List<OsgiServiceDependencyEvent> events = null;
    String filterAsString = null;

    synchronized (monitor) {
        // deregister listener to get an accurate snapshot of the
        // unsatisfied dependencies.

        if (dependencyDetector != null) {
            dependencyDetector.deregister();
            events = dependencyDetector.getUnsatisfiedDependenciesAsEvents();
            filterAsString = dependencyDetector.createUnsatisfiedDependencyFilter();
        }
    }

    Filter filter = (filterAsString != null ? OsgiFilterUtils.createFilter(filterAsString) : null);

    log.warn("Timeout occurred before finding service dependencies for [" + delegateContext.getDisplayName()
            + "]");

    String bundleName = null;
    if (System.getSecurityManager() != null) {
        bundleName = AccessController.doPrivileged(new PrivilegedAction<String>() {
            public String run() {
                return OsgiStringUtils.nullSafeSymbolicName(getBundle());
            }
        });
    } else {
        bundleName = OsgiStringUtils.nullSafeSymbolicName(getBundle());
    }

    // generate exception
    e = new ApplicationContextException("Application context " + "initialization for '" + bundleName
            + "' has timed out waiting for " + filterAsString);
    e.fillInStackTrace();

    // send notification
    delegatedMulticaster.multicastEvent(new BootstrappingDependenciesFailedEvent(delegateContext,
            delegateContext.getBundle(), e, events, filter));

    fail(e, true);
}