fix host update processor init (#8205)

Co-authored-by: caishunfeng <534328519@qq.com>
This commit is contained in:
wind 2022-01-26 17:51:20 +08:00 committed by GitHub
parent 7945a2f3aa
commit b05ba4d1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -45,17 +45,17 @@ public class HostUpdateProcessor implements NettyRequestProcessor {
/**
* task callback service
*/
private final TaskCallbackService taskCallbackService;
public HostUpdateProcessor() {
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
}
private TaskCallbackService taskCallbackService;
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.PROCESS_HOST_UPDATE_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType()));
HostUpdateCommand updateCommand = JSONUtils.parseObject(command.getBody(), HostUpdateCommand.class);
logger.info("received host update command : {}", updateCommand);
if (taskCallbackService == null) {
taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
}
taskCallbackService.changeRemoteChannel(updateCommand.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque()));
}