Search in sources :

Example 1 with TestJudgeReq

use of top.hcode.hoj.pojo.dto.TestJudgeReq in project HOJ by HimitZH.

the class JudgeReceiver method handleJudgeMsg.

@Override
public void handleJudgeMsg(String taskStr, String queueName) {
    if (Constants.Queue.TEST_JUDGE_WAITING.getName().equals(queueName)) {
        TestJudgeReq testJudgeReq = JSONUtil.toBean(taskStr, TestJudgeReq.class);
        dispatcher.dispatcherTestJudge(testJudgeReq, "/test-judge");
    } else {
        JSONObject task = JSONUtil.parseObj(taskStr);
        Judge judge = task.get("judge", Judge.class);
        String token = task.getStr("token");
        // 调用判题服务
        dispatcher.dispatcherJudge("judge", "/judge", new ToJudgeDTO().setJudge(judge).setToken(token).setRemoteJudgeProblem(null));
    }
    // 接着处理任务
    processWaitingTask();
}
Also used : JSONObject(cn.hutool.json.JSONObject) ToJudgeDTO(top.hcode.hoj.pojo.dto.ToJudgeDTO) TestJudgeReq(top.hcode.hoj.pojo.dto.TestJudgeReq) Judge(top.hcode.hoj.pojo.entity.judge.Judge)

Aggregations

JSONObject (cn.hutool.json.JSONObject)1 TestJudgeReq (top.hcode.hoj.pojo.dto.TestJudgeReq)1 ToJudgeDTO (top.hcode.hoj.pojo.dto.ToJudgeDTO)1 Judge (top.hcode.hoj.pojo.entity.judge.Judge)1