BaseContext.java 372 B

12345678910111213141516171819
  1. package com.sky.context;
  2. public class BaseContext {
  3. public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
  4. public static void setCurrentId(Long id) {
  5. threadLocal.set(id);
  6. }
  7. public static Long getCurrentId() {
  8. return threadLocal.get();
  9. }
  10. public static void removeCurrentId() {
  11. threadLocal.remove();
  12. }
  13. }