Skip to content

Commit

Permalink
[improve][common] Add thread name for RateLimiter. (apache#18013)
Browse files Browse the repository at this point in the history
  • Loading branch information
Technoboy- authored Oct 13, 2022
1 parent 92b4708 commit 240ca43
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.pulsar.common.util.Runnables.catchingAndLoggingThrowables;
import com.google.common.base.MoreObjects;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
Expand Down Expand Up @@ -80,7 +81,8 @@ public class RateLimiter implements AutoCloseable{
this.executorService = scheduledExecutorService;
this.externalExecutor = true;
} else {
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1,
new DefaultThreadFactory("pulsar-rate-limiter"));
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
this.executorService = executor;
Expand Down

0 comments on commit 240ca43

Please sign in to comment.