Created
April 9, 2023 10:51
-
-
Save sonus21/3882f6397fa4c804a42f37055eecb0a7 to your computer and use it in GitHub Desktop.
Database Context holder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DatabaseContext { | |
private static final ThreadLocal<String> databaseName = new ThreadLocal<>(); | |
public static void set(String name) { | |
databaseName.set(name); | |
} | |
public static void clear() { | |
databaseName.remove(); | |
} | |
public static String get() { | |
return databaseName.get(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment