3.3.0-release
xuxueli 2 weeks ago
commit 8248020ce5

@ -31,6 +31,11 @@ public class XxlJobContext {
*/
private final String jobLogFileName;
/**
* log date time
*/
private final long logDateTime;
// ---------------------- for shard ----------------------
/**
@ -61,10 +66,11 @@ public class XxlJobContext {
private String handleMsg;
public XxlJobContext(long jobId, String jobParam, String jobLogFileName, int shardIndex, int shardTotal) {
public XxlJobContext(long jobId, String jobParam, String jobLogFileName, long logDateTime, int shardIndex, int shardTotal) {
this.jobId = jobId;
this.jobParam = jobParam;
this.jobLogFileName = jobLogFileName;
this.logDateTime = logDateTime;
this.shardIndex = shardIndex;
this.shardTotal = shardTotal;
@ -83,6 +89,10 @@ public class XxlJobContext {
return jobLogFileName;
}
public long getLogDateTime() {
return logDateTime;
}
public int getShardIndex() {
return shardIndex;
}

@ -64,6 +64,20 @@ public class XxlJobHelper {
return xxlJobContext.getJobLogFileName();
}
/**
* current LogDateTime
*
* @return logDateTime
*/
public static long getLogDateTime() {
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext();
if (xxlJobContext == null) {
return -1;
}
return xxlJobContext.getLogDateTime();
}
// ---------------------- for shard ----------------------
/**

@ -122,6 +122,7 @@ public class JobThread extends Thread{
triggerParam.getJobId(),
triggerParam.getExecutorParams(),
logFileName,
triggerParam.getLogDateTime(),
triggerParam.getBroadcastIndex(),
triggerParam.getBroadcastTotal());

@ -209,6 +209,7 @@ public class TriggerCallbackThread {
null,
logFileName,
-1,
-1,
-1));
XxlJobHelper.log(logContent);
}

Loading…
Cancel
Save