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);
}
}
Aggregations