Reusing object instead of calling bean factory to retrieve it; fixes gh-905
This commit is contained in:
@@ -50,7 +50,7 @@ import org.springframework.util.StringUtils;
|
||||
* @since 1.2.0
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
class SleuthAdvisorConfig extends AbstractPointcutAdvisor implements BeanFactoryAware {
|
||||
class SleuthAdvisorConfig extends AbstractPointcutAdvisor implements BeanFactoryAware {
|
||||
|
||||
private Advice advice;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class SpanSubscriptionProvider<T> implements Supplier<SpanSubscription<T>> {
|
||||
final Subscriber<? super T> subscriber;
|
||||
final Context context;
|
||||
final String name;
|
||||
private Tracing tracing;
|
||||
|
||||
SpanSubscriptionProvider(BeanFactory beanFactory,
|
||||
Subscriber<? super T> subscriber,
|
||||
@@ -45,11 +46,17 @@ class SpanSubscriptionProvider<T> implements Supplier<SpanSubscription<T>> {
|
||||
}
|
||||
|
||||
@Override public SpanSubscription<T> get() {
|
||||
Tracing tracing = this.beanFactory.getBean(Tracing.class);
|
||||
return newCoreSubscriber(tracing);
|
||||
return newCoreSubscriber(tracing());
|
||||
}
|
||||
|
||||
SpanSubscription<T> newCoreSubscriber(Tracing tracing) {
|
||||
return new SpanSubscriber<>(this.subscriber, this.context, tracing, this.name);
|
||||
}
|
||||
|
||||
private Tracing tracing() {
|
||||
if (this.tracing == null) {
|
||||
this.tracing = this.beanFactory.getBean(Tracing.class);
|
||||
}
|
||||
return this.tracing;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user