All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shedhack.thread.threadlocal.utility.ThreadLocalUtility Maven / Gradle / Ivy

Go to download

ThreadLocal utility that provides static method for (String type) setting, getting and clearing a ThreadLocal..

The newest version!
package com.shedhack.thread.threadlocal.utility;

/**
 * Utility class simplifies the manner in which ThreadLocal (of String payload types) are stored, accessed and cleared.
 *
 * @author imamchishty
 */
public class ThreadLocalUtility {

    private static final ThreadLocal local = new ThreadLocal<>();

    public static void set(String requestId) {
        local.set(requestId);
    }

    public static String get() {
        return local.get();
    }

    public static void clear(){
        local.remove();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy