forked from pinpoint-apm/pinpoint
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#9595] Refactor AsyncContext
- Loading branch information
Showing
12 changed files
with
146 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
profiler/src/main/java/com/navercorp/pinpoint/profiler/context/AsyncContexts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.navercorp.pinpoint.profiler.context; | ||
|
||
import com.navercorp.pinpoint.bootstrap.context.AsyncContext; | ||
import com.navercorp.pinpoint.bootstrap.context.AsyncState; | ||
import com.navercorp.pinpoint.bootstrap.context.Trace; | ||
import com.navercorp.pinpoint.profiler.context.id.LocalTraceRoot; | ||
import com.navercorp.pinpoint.profiler.context.id.TraceRoot; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author Woonduk Kang(emeroad) | ||
*/ | ||
public final class AsyncContexts { | ||
private AsyncContexts() { | ||
} | ||
|
||
public static Remote remote(AsyncTraceContext asyncTraceContext, | ||
Binder<Trace> binder, | ||
int asyncMethodApiId) { | ||
return new Remote(asyncTraceContext, binder, asyncMethodApiId); | ||
} | ||
|
||
public static Local local(AsyncTraceContext asyncTraceContext, | ||
Binder<Trace> binder) { | ||
return new Local(asyncTraceContext, binder); | ||
} | ||
|
||
public static class Remote { | ||
private final AsyncTraceContext asyncTraceContext; | ||
private final Binder<Trace> binder; | ||
private final int asyncMethodApiId; | ||
|
||
public Remote(AsyncTraceContext asyncTraceContext, Binder<Trace> binder, int asyncMethodApiId) { | ||
this.asyncTraceContext = Objects.requireNonNull(asyncTraceContext, "asyncTraceContext"); | ||
this.binder = Objects.requireNonNull(binder, "binder"); | ||
this.asyncMethodApiId = asyncMethodApiId; | ||
} | ||
|
||
public AsyncContext sync(TraceRoot traceRoot, | ||
AsyncId asyncId) { | ||
return new DefaultAsyncContext(asyncTraceContext, binder, traceRoot, asyncId, asyncMethodApiId, null); | ||
} | ||
|
||
public AsyncContext async(TraceRoot traceRoot, | ||
AsyncState asyncState, | ||
AsyncId asyncId) { | ||
return new DefaultAsyncContext(asyncTraceContext, binder, traceRoot, asyncId, asyncMethodApiId, asyncState); | ||
} | ||
} | ||
|
||
public static class Local { | ||
|
||
private final AsyncTraceContext asyncTraceContext; | ||
private final Binder<Trace> binder; | ||
|
||
public Local(AsyncTraceContext asyncTraceContext, Binder<Trace> binder) { | ||
this.asyncTraceContext = Objects.requireNonNull(asyncTraceContext, "asyncTraceContext"); | ||
this.binder = Objects.requireNonNull(binder, "binder"); | ||
} | ||
|
||
public AsyncContext sync(LocalTraceRoot traceRoot) { | ||
return new DisableAsyncContext(asyncTraceContext, binder, traceRoot, null); | ||
} | ||
|
||
public AsyncContext async(LocalTraceRoot traceRoot, | ||
AsyncState asyncState) { | ||
return new DisableAsyncContext(asyncTraceContext, binder, traceRoot, asyncState); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
profiler/src/main/java/com/navercorp/pinpoint/profiler/context/StatefulAsyncContext.java
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...er/src/main/java/com/navercorp/pinpoint/profiler/context/StatefulDisableAsyncContext.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.