Explorar el Código

重要更新: ByteWriteFactory内部Byte[]长度改为动态初始化; 一方面在小数据量下节省字节开销;另一方面在大数据量下可以保证数据存放没问题;

xueli.xue hace 9 años
padre
commit
57abd14b6d

+ 3 - 3
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobLogController.java Ver fichero

@@ -108,10 +108,10 @@ public class JobLogController {
108 108
 		// base check
109 109
 		XxlJobLog log = xxlJobLogDao.load(id);
110 110
 		if (log == null) {
111
-			return new ReturnT<String>(500, "参数异常");
111
+			return new ReturnT<String>(500, "查看执行日志失败: 参数异常");
112 112
 		}
113 113
 		if (!(ResponseModel.SUCCESS.equals(log.getTriggerStatus()) || StringUtils.isNotBlank(log.getHandleStatus()))) {
114
-			return new ReturnT<String>(500, "调度失败,无法查看执行日志");
114
+			return new ReturnT<String>(500, "查看执行日志失败: 任务发起调度失败,无法查看执行日志");
115 115
 		}
116 116
 		
117 117
 		// trigger id, trigger time
@@ -125,7 +125,7 @@ public class JobLogController {
125 125
 		if (ResponseModel.SUCCESS.equals(responseModel.getStatus())) {
126 126
 			return new ReturnT<String>(responseModel.getMsg());
127 127
 		} else {
128
-			return new ReturnT<String>(500, responseModel.getMsg());
128
+			return new ReturnT<String>(500, "查看执行日志失败: " + responseModel.getMsg());
129 129
 		}
130 130
 	}
131 131
 	

+ 3 - 0
xxl-job-core/src/main/java/com/xxl/job/core/util/ByteWriteFactory.java Ver fichero

@@ -16,6 +16,9 @@ public class ByteWriteFactory {
16 16
 	public ByteWriteFactory() {
17 17
 		m_byteBuf = ByteBuffer.allocate(1024 * 4);
18 18
 	}
19
+	public ByteWriteFactory(int capacity) {
20
+		m_byteBuf = ByteBuffer.allocate(capacity);
21
+	}
19 22
 	
20 23
 	public void writeInt(int intValue) {
21 24
 		byte[] intBytes = new byte[4];

+ 1 - 1
xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobNetCommUtil.java Ver fichero

@@ -42,7 +42,7 @@ public class XxlJobNetCommUtil {
42 42
 		int len = ByteHexConverter.getByteLen(json);
43 43
 
44 44
 		// json to byte[]
45
-		ByteWriteFactory byteWriteFactory = new ByteWriteFactory();
45
+		ByteWriteFactory byteWriteFactory = new ByteWriteFactory(4 + len);
46 46
 		byteWriteFactory.writeInt(len);
47 47
 		byteWriteFactory.writeString(json, len);
48 48
 		byte[] bytes = byteWriteFactory.getBytes();