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

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


      final Response resp=Response.newBuilder().mergeFrom(sm.getBody()).build();
      for(ResponseListener lis:listeners){
        lis.onResponse(resp);
      }
    }else if(sm.getKind()==Kind.WEB_RESPONSE){
      final WebResponse resp=WebResponse.newBuilder().mergeFrom(sm.getBody()).build();
      for(ResponseListener lis:listeners){
        lis.onWebResponse(resp);
      }
    }
    super.messageReceived(ctx, e);
View Full Code Here


      String historyId=req.getId();
      JobHistory history=context.getJobHistoryManager().findJobHistory(historyId);
      String jobId=history.getJobId();
      context.getMaster().run(history);
     
      WebResponse resp=WebResponse.newBuilder().setRid(req.getRid()).setOperate(WebOperate.ExecuteJob)
        .setStatus(Status.OK).build();
      SocketLog.info("send web execute response,rid="+req.getRid()+",jobId="+jobId);
      return resp;
    }else if(req.getEk()==ExecuteKind.DebugKind){
      String debugId=req.getId();
      DebugHistory history=context.getDebugHistoryManager().findDebugHistory(debugId);
      SocketLog.info("receive web debug request,rid="+req.getRid()+",debugId="+debugId);
     
      context.getMaster().debug(history);
     
      WebResponse resp=WebResponse.newBuilder().setRid(req.getRid()).setOperate(WebOperate.ExecuteJob)
        .setStatus(Status.OK).build();
      SocketLog.info("send web debug response,rid="+req.getRid()+",debugId="+debugId);
      return resp;
    }
    return null;
View Full Code Here

public class MasterBeUpdate {
  public WebResponse beWebUpdate(MasterContext context,WebRequest req) {
   
    context.getDispatcher().forwardEvent(new JobMaintenanceEvent(Events.UpdateJob,req.getId()));
    WebResponse resp=WebResponse.newBuilder().setRid(req.getRid()).setOperate(WebOperate.UpdateJob)
      .setStatus(Status.OK).build();
    SocketLog.info("send web update response,rid="+req.getRid()+",jobId="+req.getId());
    return resp;
  }
View Full Code Here

    // 如果不在,将该job放入等待队列
    SocketLog.info("receive web debug request,rid="+req.getRid()+",debugId="+req.getId());
    String debugId=req.getId();
    for(String debug:new ArrayList<String>(context.getDebugQueue())){
      if(debug.equals(debugId)){
        WebResponse resp=WebResponse.newBuilder().setRid(req.getRid()).setOperate(WebOperate.ExecuteDebug)
          .setStatus(Status.ERROR).setErrorText("已经在队列中,无法再次运行").build();
        return resp;
      }
    }
   
    DebugHistory debug=context.getDebugHistoryManager().findDebugHistory(debugId);
    context.getMaster().debug(debug);
   
    WebResponse resp=WebResponse.newBuilder().setRid(req.getRid()).setOperate(WebOperate.ExecuteDebug)
      .setStatus(Status.OK).build();
    SocketLog.info("send web debug response,rid="+req.getRid()+",debugId="+debugId);
    return resp;
  }
View Full Code Here

    return null;
  }

  private WebResponse processManualCancel(MasterContext context,
      WebRequest req) {
    WebResponse ret = null;
    String historyId = req.getId();
    JobHistory history = context.getJobHistoryManager().findJobHistory(
        historyId);
    SocketLog.info("receive web cancel request,rid=" + req.getRid()
        + ",jobId=" + history.getJobId());
View Full Code Here

    return ret;
  }

  private WebResponse processDebugCancel(MasterContext context, WebRequest req) {
    WebResponse ret = null;
    String debugId = req.getId();
    DebugHistory history = context.getDebugHistoryManager()
        .findDebugHistory(debugId);
    SocketLog.info("receive web debug cancel request,rid=" + req.getRid()
        + ",debugId=" + debugId);
View Full Code Here

    return ret;
  }

  private WebResponse processScheduleCancel(MasterContext context,
      WebRequest req) {
    WebResponse ret = null;
    String historyId = req.getId();
    JobHistory history = context.getJobHistoryManager().findJobHistory(
        historyId);
    SocketLog.info("receive web cancel request,rid=" + req.getRid()
        + ",jobId=" + history.getJobId());
View Full Code Here

   *
   * @param kind
   * @param id
   */
  public void executeJobFromWeb(ExecuteKind kind, String id) throws Exception {
    WebResponse resp = new WorkerWebExecute().send(context, kind, id).get();
    if (resp.getStatus() == Status.ERROR) {
      throw new Exception(resp.getErrorText());
    }
  }
View Full Code Here

    }
  }

  public void cancelJobFromWeb(ExecuteKind kind, String id, String operator)
      throws Exception {
    WebResponse resp = new WorkerWebCancel().cancel(context, kind, id,
        operator).get();
    if (resp.getStatus() == Status.ERROR) {
      throw new ZeusException(resp.getErrorText());
    }
  }
View Full Code Here

      throw new ZeusException(resp.getErrorText());
    }
  }

  public void updateJobFromWeb(String jobId) throws Exception {
    WebResponse resp = new WorkerWebUpdate().execute(context, jobId).get();
    if (resp.getStatus() == Status.ERROR) {
      throw new Exception(resp.getErrorText());
    }
  }
View Full Code Here

TOP

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

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.