Skip to content

Commit 858d501

Browse files
Xylusemeroad
authored andcommitted
Temporarilty allow null injection until ActiveTraceRepository is refactored
1 parent 5d2da32 commit 858d501

File tree

4 files changed

+38
-7
lines changed

4 files changed

+38
-7
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2017 NAVER Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.navercorp.pinpoint.profiler.context.module;
18+
19+
import java.lang.annotation.Retention;
20+
import java.lang.annotation.Target;
21+
22+
import static java.lang.annotation.ElementType.PARAMETER;
23+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
24+
25+
/**
26+
* @author HyunGil Jeong
27+
*/
28+
@Target(PARAMETER)
29+
@Retention(RUNTIME)
30+
public @interface Nullable {
31+
}

‎profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/CommandDispatcherProvider.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.inject.Provider;
2121
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
2222
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository;
23+
import com.navercorp.pinpoint.profiler.context.module.Nullable;
2324
import com.navercorp.pinpoint.profiler.receiver.CommandDispatcher;
2425
import com.navercorp.pinpoint.profiler.receiver.ProfilerCommandLocatorBuilder;
2526
import com.navercorp.pinpoint.profiler.receiver.ProfilerCommandServiceLocator;
@@ -35,13 +36,10 @@ public class CommandDispatcherProvider implements Provider<CommandDispatcher> {
3536
private final ActiveTraceRepository activeTraceRepository;
3637

3738
@Inject
38-
public CommandDispatcherProvider(ProfilerConfig profilerConfig, ActiveTraceRepository activeTraceRepository) {
39+
public CommandDispatcherProvider(ProfilerConfig profilerConfig, @Nullable /*TODO Disallow null*/ ActiveTraceRepository activeTraceRepository) {
3940
if (profilerConfig == null) {
4041
throw new NullPointerException("profilerConfig must not be null");
4142
}
42-
if (activeTraceRepository == null) {
43-
throw new NullPointerException("activeTraceRepository must not be null");
44-
}
4543
this.profilerConfig = profilerConfig;
4644
this.activeTraceRepository = activeTraceRepository;
4745
}

‎profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/TraceFactoryProvider.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.navercorp.pinpoint.profiler.context.TraceIdFactory;
3333
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceFactory;
3434
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository;
35+
import com.navercorp.pinpoint.profiler.context.module.Nullable;
3536
import com.navercorp.pinpoint.profiler.context.storage.StorageFactory;
3637
import org.slf4j.Logger;
3738
import org.slf4j.LoggerFactory;
@@ -58,8 +59,8 @@ public class TraceFactoryProvider implements Provider<TraceFactory> {
5859

5960

6061
@Inject
61-
public TraceFactoryProvider(CallStackFactory callStackFactory, StorageFactory storageFactory, Sampler sampler, IdGenerator idGenerator, TraceIdFactory traceIdFactory, AsyncIdGenerator asyncIdGenerator, ActiveTraceRepository activeTraceRepository,
62-
SpanFactory spanFactory, RecorderFactory recorderFactory) {
62+
public TraceFactoryProvider(CallStackFactory callStackFactory, StorageFactory storageFactory, Sampler sampler, IdGenerator idGenerator, TraceIdFactory traceIdFactory, AsyncIdGenerator asyncIdGenerator,
63+
@Nullable /*TODO Disallow null*/ ActiveTraceRepository activeTraceRepository, SpanFactory spanFactory, RecorderFactory recorderFactory) {
6364
if (callStackFactory == null) {
6465
throw new NullPointerException("callStackFactory must not be null");
6566
}

‎profiler/src/main/java/com/navercorp/pinpoint/profiler/context/provider/stat/activethread/ActiveTraceMetricProvider.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceHistogramFactory;
2222
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceLocator;
2323
import com.navercorp.pinpoint.profiler.context.active.ActiveTraceRepository;
24+
import com.navercorp.pinpoint.profiler.context.module.Nullable;
2425
import com.navercorp.pinpoint.profiler.monitor.metric.activethread.ActiveTraceMetric;
2526
import com.navercorp.pinpoint.profiler.monitor.metric.activethread.DefaultActiveTraceMetric;
2627

@@ -32,7 +33,7 @@ public class ActiveTraceMetricProvider implements Provider<ActiveTraceMetric> {
3233
private final ActiveTraceLocator activeTraceLocator;
3334

3435
@Inject
35-
public ActiveTraceMetricProvider(ActiveTraceRepository activeTraceLocator) {
36+
public ActiveTraceMetricProvider(@Nullable /*TODO Disallow null*/ ActiveTraceRepository activeTraceLocator) {
3637
this.activeTraceLocator = activeTraceLocator;
3738
}
3839

0 commit comments

Comments
 (0)