Class XxlJobHelper

java.lang.Object
com.xxl.job.core.context.XxlJobHelper

public class XxlJobHelper extends Object
helper for xxl-job
Author:
xuxueli 2020-11-05
  • Constructor Details

    • XxlJobHelper

      public XxlJobHelper()
  • Method Details

    • getJobId

      public static long getJobId()
      current JobId
      Returns:
    • getJobParam

      public static String getJobParam()
      current JobParam
      Returns:
    • getJobLogFileName

      public static String getJobLogFileName()
      current JobLogFileName
      Returns:
    • getShardIndex

      public static int getShardIndex()
      current ShardIndex
      Returns:
    • getShardTotal

      public static int getShardTotal()
      current ShardTotal
      Returns:
    • log

      public static boolean log(String appendLogPattern, Object... appendLogArguments)
      append log with pattern
      Parameters:
      appendLogPattern - like "aaa {} bbb {} ccc"
      appendLogArguments - like "111, true"
    • log

      public static boolean log(Throwable e)
      append exception stack
      Parameters:
      e -
    • handleSuccess

      public static boolean handleSuccess()
      handle success
      Returns:
    • handleSuccess

      public static boolean handleSuccess(String handleMsg)
      handle success with log msg
      Parameters:
      handleMsg -
      Returns:
    • handleFail

      public static boolean handleFail()
      handle fail
      Returns:
    • handleFail

      public static boolean handleFail(String handleMsg)
      handle fail with log msg
      Parameters:
      handleMsg -
      Returns:
    • handleTimeout

      public static boolean handleTimeout()
      handle timeout
      Returns:
    • handleTimeout

      public static boolean handleTimeout(String handleMsg)
      handle timeout with log msg
      Parameters:
      handleMsg -
      Returns:
    • handleResult

      public static boolean handleResult(int handleCode, String handleMsg)
      Parameters:
      handleCode - 200 : success 500 : fail 502 : timeout
      handleMsg -
      Returns: