From 416c7489c8daa415ec1e81f699ee55cb609adc81 Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Wed, 21 Sep 2016 17:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E5=A4=84queue.poll?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84cpu=E5=8D=A0=E6=BB=A1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(=E8=AF=A5=E9=97=AE=E9=A2=98=E5=9C=A8v1.4?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BA=8E7=E6=9C=88=E4=BB=BD=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E4=BF=AE=E5=A4=8D,=20v1.3=E7=89=88=E6=9C=AC=E4=BB=8D?= =?UTF-8?q?=E7=84=B6=E9=81=97=E7=95=99=E8=AF=A5=E9=97=AE=E9=A2=98,?= =?UTF-8?q?=E7=8E=B0=E5=9C=A8=E5=90=8C=E6=AD=A5=E4=BF=AE=E5=A4=8D=E6=8E=89?= =?UTF-8?q?,=20=E6=8E=A8=E8=8D=90=E6=9B=B4=E6=96=B0=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BF=9D=E8=AF=81=E9=80=BB=E8=BE=91=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E7=A8=B3=E5=AE=9A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xxl/job/core/handler/HandlerThread.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java index 8896a5a9..b5666b0a 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/handler/HandlerThread.java @@ -1,5 +1,13 @@ package com.xxl.job.core.handler; +import com.xxl.job.core.handler.HandlerRepository.HandlerParamEnum; +import com.xxl.job.core.handler.IJobHandler.JobHandleStatus; +import com.xxl.job.core.log.XxlJobFileAppender; +import com.xxl.job.core.util.HttpUtil; +import org.eclipse.jetty.util.ConcurrentHashSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.PrintWriter; import java.io.StringWriter; import java.util.HashMap; @@ -7,15 +15,6 @@ import java.util.Map; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.eclipse.jetty.util.ConcurrentHashSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.xxl.job.core.handler.HandlerRepository.HandlerParamEnum; -import com.xxl.job.core.handler.IJobHandler.JobHandleStatus; -import com.xxl.job.core.log.XxlJobFileAppender; -import com.xxl.job.core.util.HttpUtil; - /** * handler thread * @author xuxueli 2016-1-16 19:52:47 @@ -57,7 +56,7 @@ public class HandlerThread extends Thread{ public void run() { while(!toStop){ try { - Map handlerData = handlerDataQueue.poll(); + Map handlerData = handlerDataQueue.poll(3L ,TimeUnit.SECONDS); if (handlerData!=null) { i= 0; String log_address = handlerData.get(HandlerParamEnum.LOG_ADDRESS.name());