File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
src/main/java/software/amazon/awssdk/threadcontext Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 4343 </dependencyManagement >
4444
4545 <dependencies >
46+ <dependency >
47+ <groupId >software.amazon.awssdk</groupId >
48+ <artifactId >annotations</artifactId >
49+ <version >${awsjavasdk.version} </version >
50+ </dependency >
4651 <dependency >
4752 <groupId >org.junit.jupiter</groupId >
4853 <artifactId >junit-jupiter</artifactId >
Original file line number Diff line number Diff line change 1717
1818import java .util .HashMap ;
1919import java .util .Map ;
20+ import software .amazon .awssdk .annotations .SdkProtectedApi ;
2021
22+ /**
23+ * Utility for thread-local context storage.
24+ */
25+ @ SdkProtectedApi
2126public final class ThreadStorage {
22- private static final ThreadLocal <Map <String , String >> storage = ThreadLocal .withInitial (HashMap ::new );
27+ private static final ThreadLocal <Map <String , String >> STORAGE = ThreadLocal .withInitial (HashMap ::new );
2328
24- private ThreadStorage () {}
29+ private ThreadStorage () {
30+ }
2531
2632 public static void put (String key , String value ) {
27- storage .get ().put (key , value );
33+ STORAGE .get ().put (key , value );
2834 }
2935
3036 public static String get (String key ) {
31- return storage .get ().get (key );
37+ return STORAGE .get ().get (key );
3238 }
3339
3440 public static String remove (String key ) {
35- return storage .get ().remove (key );
41+ return STORAGE .get ().remove (key );
3642 }
3743
3844 public static void clear () {
39- storage .get ().clear ();
45+ STORAGE .get ().clear ();
4046 }
4147
4248 public static boolean containsKey (String key ) {
43- return storage .get ().containsKey (key );
49+ return STORAGE .get ().containsKey (key );
4450 }
4551}
You can’t perform that action at this time.
0 commit comments