Package com.xxl.job.core.context
Class XxlJobHelper
java.lang.Object
com.xxl.job.core.context.XxlJobHelper
helper for xxl-job
- Author:
- xuxueli 2020-11-05
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetJobId()current JobIdstatic Stringcurrent JobLogFileNamestatic Stringcurrent JobParamstatic intcurrent ShardIndexstatic intcurrent ShardTotalstatic booleanhandle failstatic booleanhandleFail(String handleMsg) handle fail with log msgstatic booleanhandleResult(int handleCode, String handleMsg) static booleanhandle successstatic booleanhandleSuccess(String handleMsg) handle success with log msgstatic booleanhandle timeoutstatic booleanhandleTimeout(String handleMsg) handle timeout with log msgstatic booleanappend log with patternstatic booleanappend exception stack
-
Constructor Details
-
XxlJobHelper
public XxlJobHelper()
-
-
Method Details
-
getJobId
public static long getJobId()current JobId- Returns:
-
getJobParam
current JobParam- Returns:
-
getJobLogFileName
current JobLogFileName- Returns:
-
getShardIndex
public static int getShardIndex()current ShardIndex- Returns:
-
getShardTotal
public static int getShardTotal()current ShardTotal- Returns:
-
log
append log with pattern- Parameters:
appendLogPattern- like "aaa {} bbb {} ccc"appendLogArguments- like "111, true"
-
log
append exception stack- Parameters:
e-
-
handleSuccess
public static boolean handleSuccess()handle success- Returns:
-
handleSuccess
handle success with log msg- Parameters:
handleMsg-- Returns:
-
handleFail
public static boolean handleFail()handle fail- Returns:
-
handleFail
handle fail with log msg- Parameters:
handleMsg-- Returns:
-
handleTimeout
public static boolean handleTimeout()handle timeout- Returns:
-
handleTimeout
handle timeout with log msg- Parameters:
handleMsg-- Returns:
-
handleResult
- Parameters:
handleCode- 200 : success 500 : fail 502 : timeouthandleMsg-- Returns:
-