From 57abd14b6d97c079d04a9515956d72bca38fdfb2 Mon Sep 17 00:00:00 2001 From: "xueli.xue" Date: Mon, 25 Jul 2016 20:05:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E8=A6=81=E6=9B=B4=E6=96=B0:=20ByteWri?= =?UTF-8?q?teFactory=E5=86=85=E9=83=A8Byte[]=E9=95=BF=E5=BA=A6=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=8A=A8=E6=80=81=E5=88=9D=E5=A7=8B=E5=8C=96;=20?= =?UTF-8?q?=E4=B8=80=E6=96=B9=E9=9D=A2=E5=9C=A8=E5=B0=8F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=87=8F=E4=B8=8B=E8=8A=82=E7=9C=81=E5=AD=97=E8=8A=82=E5=BC=80?= =?UTF-8?q?=E9=94=80;=E5=8F=A6=E4=B8=80=E6=96=B9=E9=9D=A2=E5=9C=A8?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=87=8F=E4=B8=8B=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=BF=9D=E8=AF=81=E6=95=B0=E6=8D=AE=E5=AD=98=E6=94=BE=E6=B2=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xxl/job/admin/controller/JobLogController.java | 6 +++--- .../main/java/com/xxl/job/core/util/ByteWriteFactory.java | 3 +++ .../main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java index ca2ed3fe..20ffa95f 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java @@ -108,10 +108,10 @@ public class JobLogController { // base check XxlJobLog log = xxlJobLogDao.load(id); if (log == null) { - return new ReturnT(500, "参数异常"); + return new ReturnT(500, "查看执行日志失败: 参数异常"); } if (!(ResponseModel.SUCCESS.equals(log.getTriggerStatus()) || StringUtils.isNotBlank(log.getHandleStatus()))) { - return new ReturnT(500, "调度失败,无法查看执行日志"); + return new ReturnT(500, "查看执行日志失败: 任务发起调度失败,无法查看执行日志"); } // trigger id, trigger time @@ -125,7 +125,7 @@ public class JobLogController { if (ResponseModel.SUCCESS.equals(responseModel.getStatus())) { return new ReturnT(responseModel.getMsg()); } else { - return new ReturnT(500, responseModel.getMsg()); + return new ReturnT(500, "查看执行日志失败: " + responseModel.getMsg()); } } diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/ByteWriteFactory.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/ByteWriteFactory.java index 51cc236a..36051294 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/ByteWriteFactory.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/ByteWriteFactory.java @@ -16,6 +16,9 @@ public class ByteWriteFactory { public ByteWriteFactory() { m_byteBuf = ByteBuffer.allocate(1024 * 4); } + public ByteWriteFactory(int capacity) { + m_byteBuf = ByteBuffer.allocate(capacity); + } public void writeInt(int intValue) { byte[] intBytes = new byte[4]; diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java b/xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java index 7afb3cae..c7744ee8 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java @@ -42,7 +42,7 @@ public class XxlJobNetCommUtil { int len = ByteHexConverter.getByteLen(json); // json to byte[] - ByteWriteFactory byteWriteFactory = new ByteWriteFactory(); + ByteWriteFactory byteWriteFactory = new ByteWriteFactory(4 + len); byteWriteFactory.writeInt(len); byteWriteFactory.writeString(json, len); byte[] bytes = byteWriteFactory.getBytes();