/** * Get the implicit {@link SharedResourcesBroker} in the callers thread. This is either a singleton broker configured * from environment variables, java options, and classpath configuration options, or a specific broker injected * elsewhere in the application. * * In general, it is preferable to explicitly pass around {@link SharedResourcesBroker}s, as that allows better * control over the scoping. However, in cases where it is hard to do so, this method provides an alternative to * method of acquiring a configured broker. */ public static SharedResourcesBroker<?> getImplicitBroker() { SharedResourcesBroker<?> threadLocal = threadLocalBroker.get(); return threadLocal == null ? getSingleton() : threadLocal; }
/** * Get the implicit {@link SharedResourcesBroker} in the callers thread. This is either a singleton broker configured * from environment variables, java options, and classpath configuration options, or a specific broker injected * elsewhere in the application. * * In general, it is preferable to explicitly pass around {@link SharedResourcesBroker}s, as that allows better * control over the scoping. However, in cases where it is hard to do so, this method provides an alternative to * method of acquiring a configured broker. */ public static SharedResourcesBroker<?> getImplicitBroker() { SharedResourcesBroker<?> threadLocal = threadLocalBroker.get(); return threadLocal == null ? getSingleton() : threadLocal; }