3.3.0-release
xuxueli 2 weeks ago
commit 8248020ce5

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

@ -64,6 +64,20 @@ public class XxlJobHelper {
return xxlJobContext.getJobLogFileName(); 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 ---------------------- // ---------------------- for shard ----------------------
/** /**

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

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

Loading…
Cancel
Save