package com.nms.server.thread.mission;

import org.apache.log4j.Logger;

import com.nms.server.util.ExceptionPrintUtils;
import com.nms.server.util.socket.SSLSocketCallable;

public class NMSClientTask4Cancel extends SSLSocketCallable{
	private final Logger logger = Logger.getLogger(NMSClientTask4Cancel.class);
	private long missionId;
	public NMSClientTask4Cancel(String ip,int port,long missionId)  throws Exception{
		super(ip,port);
		this.missionId = missionId;
	}

	@Override
	protected String toDo() throws Exception {
		Thread.currentThread().setName("Task 4:> "+missionId+" IP:> "+this.socket.getRemoteSocketAddress());
		try {
			
			//撤销任务
			this.sendMessage("char:taskCancel");
			this.receiveMessage();
			this.sendMessage(missionId+"");
			String string =  this.receiveMessage();
			logger.debug("任务执行下发结果是 "+string);
			this.sendMessage(SUCCESS);
			return string;
		
		} catch (Exception e) {
			logger.error(ExceptionPrintUtils.printExceptionStack(e));
			return null;
		}
	}
}
