forked from sofastack/sofa-tracer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
java.util.concurrent.Executor
(sofastack#515)
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
tracer-core/src/main/java/com/alipay/common/tracer/core/async/SofaTraceExecutor.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,32 @@ | ||
package com.alipay.common.tracer.core.async; | ||
|
||
import java.util.concurrent.Executor; | ||
import java.util.concurrent.RejectedExecutionException; | ||
|
||
/** | ||
* @author xYohn | ||
* @date 2023/12/7 | ||
*/ | ||
public class SofaTraceExecutor implements Executor { | ||
|
||
private final Executor delegate; | ||
|
||
public SofaTraceExecutor(Executor delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
/** | ||
* Executes the given command at some time in the future. The command | ||
* may execute in a new thread, in a pooled thread, or in the calling | ||
* thread, at the discretion of the {@code Executor} implementation. | ||
* | ||
* @param command the runnable task | ||
* @throws RejectedExecutionException if this task cannot be | ||
* accepted for execution | ||
* @throws NullPointerException if command is null | ||
*/ | ||
@Override | ||
public void execute(Runnable command) { | ||
delegate.execute(new SofaTracerRunnable(command)); | ||
} | ||
} |