Search in sources :

Example 1 with UnmanagedThreadException

use of ratpack.exec.UnmanagedThreadException in project ratpack by ratpack.

the class ExecutionBasedScope method getScopedObjectMap.

private Map<Key<?>, Object> getScopedObjectMap(Key<?> key) {
    try {
        Execution execution = Execution.current();
        if (!inScope(execution)) {
            throw new OutOfScopeException("Cannot access " + key + " outside of " + name);
        }
        return execution.maybeGet(storeType).orElseGet(() -> {
            S store = createStore();
            execution.add(storeType, store);
            return store;
        });
    } catch (UnmanagedThreadException e) {
        throw new OutOfScopeException("Cannot access " + key + " outside of " + name);
    }
}
Also used : Execution(ratpack.exec.Execution) UnmanagedThreadException(ratpack.exec.UnmanagedThreadException)

Aggregations

Execution (ratpack.exec.Execution)1 UnmanagedThreadException (ratpack.exec.UnmanagedThreadException)1