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

org.sklsft.commons.log.context.RequestContextHolder Maven / Gradle / Ivy

package org.sklsft.commons.log.context;

/**
 * A class containing a static {@link ThreadLocal} that holds a {@link RequestContext}.
 * @author Nicolas Thibault
 *
 */
public class RequestContextHolder {
	
	private static ThreadLocal allContexts = new ThreadLocal<>();

	public static void bind(RequestContext context) {
		allContexts.set(context);
	}	

	public static void unbind() {
		allContexts.remove();
	}

	public static RequestContext getContextOrNull() {
		return allContexts.get();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy