|
|
@ -51,17 +51,6 @@ public class WorkerServer { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class); |
|
|
|
private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* fetch task executor service |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private ExecutorService fetchTaskExecutorService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* CountDownLatch latch |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private CountDownLatch latch; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* worker config |
|
|
|
* worker config |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -120,9 +109,6 @@ public class WorkerServer { |
|
|
|
this.workerRegistry = new WorkerRegistry(zookeeperRegistryCenter, serverConfig.getListenPort(), workerConfig.getWorkerHeartbeatInterval(), workerConfig.getWorkerGroup()); |
|
|
|
this.workerRegistry = new WorkerRegistry(zookeeperRegistryCenter, serverConfig.getListenPort(), workerConfig.getWorkerHeartbeatInterval(), workerConfig.getWorkerGroup()); |
|
|
|
this.workerRegistry.registry(); |
|
|
|
this.workerRegistry.registry(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.fetchTaskExecutorService = ThreadUtils.newDaemonSingleThreadExecutor("Worker-Fetch-Thread-Executor"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* register hooks, which are called before the process exits |
|
|
|
* register hooks, which are called before the process exits |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -132,13 +118,6 @@ public class WorkerServer { |
|
|
|
close("shutdownHook"); |
|
|
|
close("shutdownHook"); |
|
|
|
} |
|
|
|
} |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
//let the main thread await
|
|
|
|
|
|
|
|
latch = new CountDownLatch(1); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
latch.await(); |
|
|
|
|
|
|
|
} catch (InterruptedException ignore) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void close(String cause) { |
|
|
|
public void close(String cause) { |
|
|
@ -169,19 +148,6 @@ public class WorkerServer { |
|
|
|
}catch (Exception e){ |
|
|
|
}catch (Exception e){ |
|
|
|
logger.warn("threadPool service stopped exception:{}",e.getMessage()); |
|
|
|
logger.warn("threadPool service stopped exception:{}",e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
logger.info("threadPool service stopped"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
fetchTaskExecutorService.shutdownNow(); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.warn("worker fetch task service stopped exception:{}",e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
logger.info("worker fetch task service stopped"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
latch.countDown(); |
|
|
|
|
|
|
|
logger.info("zookeeper service stopped"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("worker server stop exception ", e); |
|
|
|
logger.error("worker server stop exception ", e); |
|
|
|
System.exit(-1); |
|
|
|
System.exit(-1); |
|
|
|