@Override public <T, K extends SharedResourceKey> T getSharedResourceAtScope(SharedResourceFactory<T, K, S> factory, K key, S scope) throws NotConfiguredException, NoSuchScopeException { try { return this.brokerCache.getScoped(factory, key, getWrappedScope(scope), this); } catch (ExecutionException ee) { throw new RuntimeException(ee); } }
/** * Get an object for the specified factory, key, and broker at the scope selected by the factory. {@link DefaultBrokerCache} * guarantees that calling this method from brokers with the same leaf scope will return the same object. */ @SuppressWarnings(value = "unchecked") <T, K extends SharedResourceKey> T getAutoScoped(final SharedResourceFactory<T, K, S> factory, final K key, final SharedResourcesBrokerImpl<S> broker) throws ExecutionException { // figure out auto scope RawJobBrokerKey autoscopeCacheKey = new RawJobBrokerKey(broker.getWrappedSelfScope(), factory.getName(), key); ScopeWrapper<S> selectedScope = this.autoScopeCache.get(autoscopeCacheKey, new Callable<ScopeWrapper<S>>() { @Override public ScopeWrapper<S> call() throws Exception { return broker.getWrappedScope(factory.getAutoScope(broker, broker.getConfigView(null, key, factory.getName()))); } }); // get actual object return getScoped(factory, key, selectedScope, broker); }
@Override public <T, K extends SharedResourceKey> T getSharedResourceAtScope(SharedResourceFactory<T, K, S> factory, K key, S scope) throws NotConfiguredException, NoSuchScopeException { try { return this.brokerCache.getScoped(factory, key, getWrappedScope(scope), this); } catch (ExecutionException ee) { throw new RuntimeException(ee); } }
/** * Get an object for the specified factory, key, and broker at the scope selected by the factory. {@link DefaultBrokerCache} * guarantees that calling this method from brokers with the same leaf scope will return the same object. */ @SuppressWarnings(value = "unchecked") <T, K extends SharedResourceKey> T getAutoScoped(final SharedResourceFactory<T, K, S> factory, final K key, final SharedResourcesBrokerImpl<S> broker) throws ExecutionException { // figure out auto scope RawJobBrokerKey autoscopeCacheKey = new RawJobBrokerKey(broker.getWrappedSelfScope(), factory.getName(), key); ScopeWrapper<S> selectedScope = this.autoScopeCache.get(autoscopeCacheKey, new Callable<ScopeWrapper<S>>() { @Override public ScopeWrapper<S> call() throws Exception { return broker.getWrappedScope(factory.getAutoScope(broker, broker.getConfigView(null, key, factory.getName()))); } }); // get actual object return getScoped(factory, key, selectedScope, broker); }