Search in sources :

Example 1 with CloseErrorsImpl

use of org.apache.camel.guice.support.internal.CloseErrorsImpl in project camel by apache.

the class CloseableScope method close.

/**
     * Closes all of the objects within the given injector of the specified
     * scope and clears the scope
     */
public void close(Injector injector) throws CloseFailedException {
    Preconditions.checkNotNull(injector, "injector");
    CloseErrorsImpl errors = new CloseErrorsImpl(this);
    Injectors.close(injector, scopeAnnotation, errors);
    synchronized (map) {
        map.clear();
    }
    errors.throwIfNecessary();
}
Also used : CloseErrorsImpl(org.apache.camel.guice.support.internal.CloseErrorsImpl)

Example 2 with CloseErrorsImpl

use of org.apache.camel.guice.support.internal.CloseErrorsImpl in project camel by apache.

the class InjectorManager method closeInjectors.

protected void closeInjectors() throws CloseFailedException {
    CloseErrors errors = new CloseErrorsImpl(this);
    Set<Entry<Object, Injector>> entries = injectors.entrySet();
    for (Entry<Object, Injector> entry : entries) {
        Injector injector = entry.getValue();
        Injectors.close(injector, errors);
    }
    injectors.clear();
    errors.throwIfNecessary();
}
Also used : CloseErrorsImpl(org.apache.camel.guice.support.internal.CloseErrorsImpl) Entry(java.util.Map.Entry) Injector(com.google.inject.Injector) CloseErrors(org.apache.camel.guice.support.CloseErrors)

Aggregations

CloseErrorsImpl (org.apache.camel.guice.support.internal.CloseErrorsImpl)2 Injector (com.google.inject.Injector)1 Entry (java.util.Map.Entry)1 CloseErrors (org.apache.camel.guice.support.CloseErrors)1