SuperTask.java 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.yiidata.intergration.web.task;
  2. /**
  3. *
  4. * Spark 任务并发控制,控制总超类
  5. *
  6. * <pre>
  7. *
  8. * Created by zhaopx.
  9. * User: zhaopx
  10. * Date: 2020/11/17
  11. * Time: 11:11
  12. *
  13. * </pre>
  14. *
  15. * @author zhaopx
  16. */
  17. public abstract class SuperTask implements Runnable {
  18. final String taskId;
  19. public SuperTask(String taskId) {
  20. this.taskId = taskId;
  21. }
  22. /**
  23. * 获取前端 TASKID
  24. *
  25. * @return
  26. */
  27. public final String getTaskId() {
  28. return taskId;
  29. }
  30. /**
  31. * 执行任务
  32. */
  33. @Override
  34. public final void run() {
  35. try {
  36. doExecute();
  37. } catch (Exception e) {
  38. throw new IllegalStateException(e);
  39. }
  40. }
  41. /**
  42. * 执行任务
  43. * @throws Exception
  44. */
  45. public abstract void doExecute() throws Exception;
  46. }