From 5268a2b7dfa556bd6f5a2d5e446cea3ea9940c10 Mon Sep 17 00:00:00 2001
From: kimi <kimi42345@gmail.com>
Date: 星期三, 22 四月 2020 11:18:23 +0800
Subject: [PATCH] add 分发     master_author 添加字段   subscribe increment,   添加7个表  master_author_subscribe   master_author_unactive   sys_dispense_config   sys_dispense_logs  sys_view   sys_view_join   sys_view_logic

---
 src/main/java/com/highdatas/mdm/util/pool/PriorityTask.java |   49 +++++++++++--------------------------------------
 1 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/src/main/java/com/highdatas/mdm/util/pool/PriorityTask.java b/src/main/java/com/highdatas/mdm/util/pool/PriorityTask.java
index c0b17b3..5d11279 100644
--- a/src/main/java/com/highdatas/mdm/util/pool/PriorityTask.java
+++ b/src/main/java/com/highdatas/mdm/util/pool/PriorityTask.java
@@ -1,16 +1,10 @@
 package com.highdatas.mdm.util.pool;
 
-import com.alibaba.fastjson.JSONObject;
-import com.highdatas.mdm.pojo.CodeMsg;
-import com.highdatas.mdm.pojo.Result;
 import com.highdatas.mdm.util.Constant;
 import com.highdatas.mdm.util.DbUtils;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.MediaType;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
 import java.util.Date;
 
 /**
@@ -26,22 +20,24 @@
     @Value("${pool.timeout}")
     Integer timeout;
     protected Long prority;
-    protected String code;
+    protected volatile MqEntity mqEntity;
     protected int cnt;
     protected Date time;
     protected Date endTime;
     protected HttpServletResponse response;
 
-    public PriorityTask(String code, HttpServletResponse response, int cnt, Date time) {
-        this.code = code;
-        this.response = response;
+    public MqEntity getMqEntity() {
+        return mqEntity;
+    }
+
+    public PriorityTask(MqEntity mqEntity, int cnt, Date time) {
+        this.mqEntity = mqEntity;
         calPrority();
         calEndTime();
     }
 
-    public PriorityTask(String code, HttpServletResponse response) {
-        this.code = code;
-        this.response = response;
+    public PriorityTask(MqEntity mqEntity) {
+        this.mqEntity = mqEntity;
     }
 
     public void calEndTime() {
@@ -64,9 +60,6 @@
         this.prority = basePrority;
     }
 
-    public String getCode() {
-        return code;
-    }
 
     public int getCnt() {
         return cnt;
@@ -80,14 +73,10 @@
         return time;
     }
 
-    public HttpServletResponse getResponse() {
-        return response;
-    }
 
-    public PriorityTask(String code, long prority, HttpServletResponse response) {
+    public PriorityTask(MqEntity mqEntity, long prority) {
         this.prority = prority;
-        this.code = code;
-        this.response = response;
+        this.mqEntity = mqEntity;
     }
 
     public void setCnt(int cnt) {
@@ -99,10 +88,6 @@
         this.time = time;
         calPrority();
         calEndTime();
-    }
-
-    public void setResponse(HttpServletResponse response) {
-        this.response = response;
     }
 
     public long getPrority() {
@@ -118,17 +103,5 @@
         return prority.compareTo(o.getPrority());
     }
 
-    public void printTimeOut() throws IOException {
-        PrintWriter writer = response.getWriter();
-        response.setCharacterEncoding("UTF-8");
-        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
-        writer.write(JSONObject.toJSONString(Result.error(CodeMsg.TIMOUT_ERROR)));
-    }
 
-    public void printRepeat() throws IOException {
-        PrintWriter writer = response.getWriter();
-        response.setCharacterEncoding("UTF-8");
-        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
-        writer.write(JSONObject.toJSONString(Result.error(CodeMsg.REPEAT_ERROR)));
-    }
 }

--
Gitblit v1.8.0