프로세스 종료 후크 코드는 다음과 같습니다.
@Override
public void shutdown() {
CoordinatorRegistryCenter regCenter = JobRegistry.getInstance().getRegCenter(jobName);
if (null == regCenter) {
return;
}
LeaderService leaderService = new LeaderService(regCenter, jobName);
if (leaderService.isLeader()) {
leaderService.removeLeader();
}
new InstanceService(regCenter, jobName).removeInstance();
}
해당 로그
[zk: localhost:2181(CONNECTED) 13] ls /elasticJobDemo/test-jobName/instances/192.168.157.1@-@11648
[]
[zk: localhost:2181(CONNECTED) 14] ls /elasticJobDemo/test-jobName/
Path must not end with / character
[zk: localhost:2181(CONNECTED) 15] ls /elasticJobDemo/test-jobName
[config, instances, leader, servers, sharding, systemTime]
[zk: localhost:2181(CONNECTED) 16] ls /elasticJobDemo/test-jobName/servers
[192.168.157.1]