fixed BootService cann't run issue.
This commit is contained in:
parent
4ddcb18d7f
commit
fd28612e7c
|
|
@ -32,8 +32,7 @@ public class DefaultNamedThreadFactory implements ThreadFactory {
|
|||
}
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = new Thread();
|
||||
t.setName(namePrefix + threadSeq.getAndIncrement());
|
||||
Thread t = new Thread(null, r,namePrefix + threadSeq.getAndIncrement(),0);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public class AppAndServiceRegisterClient implements BootService, GRPCChannelList
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("AppAndServiceRegisterClient running, status:{}.",status);
|
||||
boolean shouldTry = true;
|
||||
while (CONNECTED.equals(status) && shouldTry) {
|
||||
shouldTry = false;
|
||||
|
|
|
|||
|
|
@ -33,12 +33,11 @@ import java.util.concurrent.ScheduledFuture;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import org.skywalking.apm.agent.core.boot.BootService;
|
||||
import org.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory;
|
||||
import org.skywalking.apm.agent.core.conf.Config;
|
||||
import org.skywalking.apm.agent.core.conf.RemoteDownstreamConfig;
|
||||
import org.skywalking.apm.logging.ILog;
|
||||
import org.skywalking.apm.logging.LogManager;
|
||||
|
||||
import static org.skywalking.apm.agent.core.conf.Config.Collector.GRPC_CHANNEL_CHECK_INTERVAL;
|
||||
|
||||
/**
|
||||
* @author wusheng
|
||||
*/
|
||||
|
|
@ -60,7 +59,7 @@ public class GRPCChannelManager implements BootService, Runnable {
|
|||
public void boot() throws Throwable {
|
||||
connectCheckFuture = Executors
|
||||
.newSingleThreadScheduledExecutor(new DefaultNamedThreadFactory("GRPCChannelManager"))
|
||||
.scheduleAtFixedRate(this, 0, GRPC_CHANNEL_CHECK_INTERVAL, TimeUnit.SECONDS);
|
||||
.scheduleAtFixedRate(this, 0, Config.Collector.GRPC_CHANNEL_CHECK_INTERVAL, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -72,10 +71,12 @@ public class GRPCChannelManager implements BootService, Runnable {
|
|||
public void shutdown() throws Throwable {
|
||||
connectCheckFuture.cancel(true);
|
||||
managedChannel.shutdownNow();
|
||||
logger.debug("Selected collector grpc service shutdown.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("Selected collector grpc service running, reconnect:{}.",reconnect);
|
||||
if (reconnect) {
|
||||
if (RemoteDownstreamConfig.Collector.GRPC_SERVERS.size() > 0) {
|
||||
int index = random.nextInt() % RemoteDownstreamConfig.Collector.GRPC_SERVERS.size();
|
||||
|
|
@ -101,7 +102,7 @@ public class GRPCChannelManager implements BootService, Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
logger.debug("Selected collector grpc service is not available. Wait {} seconds to retry", GRPC_CHANNEL_CHECK_INTERVAL);
|
||||
logger.debug("Selected collector grpc service is not available. Wait {} seconds to retry", Config.Collector.GRPC_CHANNEL_CHECK_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue