Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,10 @@ public synchronized BackupRegistry get() {
// default size of 2 - 1 each for heartbeat and cacheRefresh
scheduler = Executors.newScheduledThreadPool(2,
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "DiscoveryClient-%d");
Thread thread = new Thread(r, "DiscoveryClient-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand All @@ -366,9 +367,10 @@ public Thread newThread(Runnable r) {
1, clientConfig.getHeartbeatExecutorThreadPoolSize(), 0, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "DiscoveryClient-HeartbeatExecutor-%d");
Thread thread = new Thread(r, "DiscoveryClient-HeartbeatExecutor-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand All @@ -379,9 +381,10 @@ public Thread newThread(Runnable r) {
1, clientConfig.getCacheRefreshExecutorThreadPoolSize(), 0, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(),
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "DiscoveryClient-CacheRefreshExecutor-%d");
Thread thread = new Thread(r, "DiscoveryClient-CacheRefreshExecutor-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand Down Expand Up @@ -460,7 +463,7 @@ public Thread newThread(Runnable r) {
private void scheduleServerEndpointTask(EurekaTransport eurekaTransport,
AbstractDiscoveryClientOptionalArgs args) {


Collection<?> additionalFilters = args == null
? Collections.emptyList()
: args.additionalFilters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

/**
Expand Down Expand Up @@ -45,9 +46,10 @@ class InstanceInfoReplicator implements Runnable {
this.instanceInfo = instanceInfo;
this.scheduler = Executors.newScheduledThreadPool(1,
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "DiscoveryClient-InstanceInfoReplicator-%d");
Thread thread = new Thread(r, "DiscoveryClient-InstanceInfoReplicator-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand Down Expand Up @@ -95,13 +97,13 @@ public boolean onDemandUpdate() {
@Override
public void run() {
logger.debug("Executing on-demand update of local InstanceInfo");

Future latestPeriodic = scheduledPeriodicRef.get();
if (latestPeriodic != null && !latestPeriodic.isDone()) {
logger.debug("Canceling the latest scheduled update, it will be rescheduled at the end of on demand update");
latestPeriodic.cancel(false);
}

InstanceInfoReplicator.this.run();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import static com.netflix.discovery.EurekaClientNames.METRIC_RESOLVER_PREFIX;
Expand Down Expand Up @@ -109,9 +110,10 @@ public AsyncResolver(String name,
this, AsyncResolver::getLastLoadTimestamp);

this.executorService = Executors.newScheduledThreadPool(1, new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "AsyncResolver-" + name + "-%d");
Thread thread = new Thread(r, "AsyncResolver-" + name + "-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand All @@ -121,9 +123,10 @@ public Thread newThread(Runnable r) {
1, executorThreadPoolSize, 0, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), // use direct handoff
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "AsyncResolver-" + name + "-executor-%d");
Thread thread = new Thread(r, "AsyncResolver-" + name + "-executor-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
Expand Down Expand Up @@ -191,9 +192,10 @@ public void run() {

scheduler = Executors.newScheduledThreadPool(1,
new ThreadFactory() {
private final AtomicInteger threadNumber = new AtomicInteger(1);
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r, "Eureka-RemoteRegionCacheRefresher_" + regionName + "-%d");
Thread thread = new Thread(r, "Eureka-RemoteRegionCacheRefresher_" + regionName + "-" + threadNumber.getAndIncrement());
thread.setDaemon(true);
return thread;
}
Expand Down
Loading