Blame view

zteits-job/src/main/java/com/zteits/job/config/datasource/DatabaseContextHolder.java 436 Bytes
3a404b2a   zhaowg   空闲车位获取和推送
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  package com.zteits.job.config.datasource;
  
  /**
   * 作用:
   * 1、保存一个线程安全的DatabaseType容器
   */
  public class DatabaseContextHolder {
      private static final ThreadLocal<DatabaseType> contextHolder = new ThreadLocal<>();
  
      public static DatabaseType getDatabaseType(){
          return contextHolder.get();
      }
  
      public static void setDatabaseType(DatabaseType type) {
          contextHolder.set(type);
      }
  }