private Future<Response> schedule(final WorkerContext context,
final Request req) {
// 查找该job是否在运行中,如果在,响应ERROR
// 如果不在,开始执行job,等待执行完毕后,发送完毕请求
ExecuteMessage em = null;
try {
em = ExecuteMessage.newBuilder().mergeFrom(req.getBody()).build();
} catch (InvalidProtocolBufferException e1) {
}
SocketLog.info("receive master to worker execute request,rid="
+ req.getRid() + ",jobId=" + em.getJobId());
final String jobId = em.getJobId();
if (context.getRunnings().containsKey(jobId)) {
SocketLog
.info("send execute response,job is running and can't run again,rid="
+ req.getRid() + ",jobId=" + em.getJobId());
return context.getThreadPool().submit(new Callable<Response>() {
public Response call() throws Exception {
return Response.newBuilder().setRid(req.getRid())
.setOperate(Operate.Schedule).setStatus(
Status.ERROR).build();