[improve][common] Add thread name for RateLimiter.
@@ -21,6 +21,7 @@ package org.apache.pulsar.common.util;
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;
@@ -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;
