Package com.taobao.zeus.socket.protocol.Protocol

Examples of com.taobao.zeus.socket.protocol.Protocol.ExecuteMessage


    // 响应OK 则添加监听器,继续等待任务完成的消息
    // 响应失败,返回失败退出码
    JobHistory history=context.getJobHistoryManager().findJobHistory(id);
    final String jobId=history.getJobId();
    holder.getRunnings().put(jobId,false);
    ExecuteMessage em=ExecuteMessage.newBuilder().setJobId(jobId).build();
    final Request req=Request.newBuilder().setRid(AtomicIncrease.getAndIncrement()).setOperate(Operate.Schedule)
      .setBody(em.toByteString()).build();
    SocketMessage sm=SocketMessage.newBuilder().setKind(Kind.REQUEST).setBody(req.toByteString()).build();
    Future<Response> f=context.getThreadPool().submit(new Callable<Response>() {
      private Response response;
      public Response call() throws Exception {
        final CountDownLatch latch=new CountDownLatch(1);
View Full Code Here


  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();
View Full Code Here

TOP

Related Classes of com.taobao.zeus.socket.protocol.Protocol.ExecuteMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.