Spring Framework NamedThreadLocal - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework NamedThreadLocal class.

This code example shows how to use the following methods:
 */ 
public class ProxyCreationContext {
 
	/** ThreadLocal holding the current proxied bean name during Advisor matching */ 
	private static final ThreadLocal<String> currentProxiedBeanName =
			new NamedThreadLocal<String>("Name of currently proxied bean");
 
 
	/** 
	 * Return the name of the currently proxied bean instance. 
	 * @return the name of the bean, or {@code null} if none available 
	 */ 
	public static String getCurrentProxiedBeanName() {
		return currentProxiedBeanName.get();
	} 
 
	/** 
	 * Set the name of the currently proxied bean instance. 
	 * @param beanName the name of the bean, or {@code null} to reset it 
	 */ 
6
CodeRank
This code example shows how to use the following methods:
 */ 
@UsesJava8 
public final class DateTimeContextHolder {
 
	private static final ThreadLocal<DateTimeContext> dateTimeContextHolder =
			new NamedThreadLocal<DateTimeContext>("DateTime Context");
 
 
	/** 
	 * Reset the DateTimeContext for the current thread. 
	 */ 
	public static void resetDateTimeContext() { 
		dateTimeContextHolder.remove();
	} 
 
	/** 
	 * Associate the given DateTimeContext with the current thread. 
	 * @param dateTimeContext the current DateTimeContext, 
	 * or {@code null} to reset the thread-bound context 
	 */ 
6
CodeRank
This code example shows how to use the following methods:
 * @since 3.0 
 */ 
public final class JodaTimeContextHolder { 
 
	private static final ThreadLocal<JodaTimeContext> jodaTimeContextHolder = 
			new NamedThreadLocal<JodaTimeContext>("JodaTime Context"); 
 
 
	/** 
	 * Reset the JodaTimeContext for the current thread. 
	 */ 
	public static void resetJodaTimeContext() { 
		jodaTimeContextHolder.remove(); 
	} 
 
	/** 
	 * Associate the given JodaTimeContext with the current thread. 
	 * @param jodaTimeContext the current JodaTimeContext, 
	 * or {@code null} to reset the thread-bound context 
	 */ 
6
CodeRank
This code example shows how to use the following methods:
	 * ThreadLocal holder for AOP proxy associated with this thread. 
	 * Will contain {@code null} unless the "exposeProxy" property on 
	 * the controlling proxy configuration has been set to "true". 
	 * @see ProxyConfig#setExposeProxy 
	 */ 
	private static final ThreadLocal<Object> currentProxy = new NamedThreadLocal<Object>("Current AOP proxy");
 
 
	/** 
	 * Try to return the current AOP proxy. This method is usable only if the 
	 * calling method has been invoked via AOP, and the AOP framework has been set 
	 * to expose proxies. Otherwise, this method will throw an IllegalStateException. 
	 * @return Object the current AOP proxy (never returns {@code null}) 
	 * @throws IllegalStateException if the proxy cannot be found, because the 
	 * method was invoked outside an AOP invocation context, or because the 
	 * AOP framework has not been configured to expose the proxy 
	 */ 
	public static Object currentProxy() throws IllegalStateException {
		Object proxy = currentProxy.get();
		if (proxy == null) {
6
CodeRank
This code example shows how to use the following methods:
 * @since 4.1 
 */ 
public abstract class SimpAttributesContextHolder {
 
	private static final ThreadLocal<SimpAttributes> attributesHolder =
			new NamedThreadLocal<SimpAttributes>("SiMP session attributes");
 
 
	/** 
	 * Reset the SimpAttributes for the current thread. 
	 */ 
	public static void resetAttributes() { 
		attributesHolder.remove();
	} 
 
	/** 
	 * Bind the given SimpAttributes to the current thread, 
	 * @param attributes the RequestAttributes to expose 
	 */ 
	public static void setAttributes(SimpAttributes attributes) {
6
CodeRank
This code example shows how to use the following methods:
public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnectionFactory {
 
	private ConnectionSpec connectionSpec;
 
	private final ThreadLocal<ConnectionSpec> threadBoundSpec =
			new NamedThreadLocal<ConnectionSpec>("Current CCI ConnectionSpec");
 
 
	/** 
	 * Set the ConnectionSpec that this adapter should use for retrieving Connections. 
	 * Default is none. 
	 */ 
	public void setConnectionSpec(ConnectionSpec connectionSpec) {
		this.connectionSpec = connectionSpec;
	} 
 
	/** 
	 * Set a ConnectionSpec for this proxy and the current thread. 
	 * The given ConnectionSpec will be applied to all subsequent 
	 * {@code getConnection()} calls on this ConnectionFactory proxy. 
5
CodeRank
This code example shows how to use the following methods:
 * @see org.springframework.web.servlet.DispatcherServlet 
 */ 
public abstract class LocaleContextHolder {
 
	private static final ThreadLocal<LocaleContext> localeContextHolder =
			new NamedThreadLocal<LocaleContext>("Locale context");
 
	private static final ThreadLocal<LocaleContext> inheritableLocaleContextHolder =
			new NamedInheritableThreadLocal<LocaleContext>("Locale context");
 
 
	/** 
	 * Reset the LocaleContext for the current thread. 
	 */ 
	public static void resetLocaleContext() { 
		localeContextHolder.remove();
		inheritableLocaleContextHolder.remove();
	} 
 
	/** 
5
CodeRank
This code example shows how to use the following methods:
 
	private static final ThreadLocal<Map<Object, Object>> resources =
			new NamedThreadLocal<Map<Object, Object>>("Transactional resources");
 
	private static final ThreadLocal<Set<TransactionSynchronization>> synchronizations =
			new NamedThreadLocal<Set<TransactionSynchronization>>("Transaction synchronizations");
 
	private static final ThreadLocal<String> currentTransactionName =
			new NamedThreadLocal<String>("Current transaction name");
 
	private static final ThreadLocal<Boolean> currentTransactionReadOnly =
			new NamedThreadLocal<Boolean>("Current transaction read-only status");
 
	private static final ThreadLocal<Integer> currentTransactionIsolationLevel =
			new NamedThreadLocal<Integer>("Current transaction isolation level");
 
	private static final ThreadLocal<Boolean> actualTransactionActive =
			new NamedThreadLocal<Boolean>("Actual transaction active");
 
 
4
CodeRank
This code example shows how to use the following methods:
 * 
 */ 
public class RequestFilter extends OncePerRequestFilter { 
	 
	private static final Log logger = LogFactory.getLog(RequestFilter.class); 
	private static final ThreadLocal<HttpServletRequest> requestHolder = new NamedThreadLocal<HttpServletRequest>("request"); 
	 
	private final static String methodAttribute = "_method"; 
	 
	private MultipartResolver multipartResolver = null; 
	 
	static String getRemoteAddr(HttpServletRequest request) { 
		String result = request.getHeader("X-Forwarded-For"); 
		if (result == null) { 
			result = request.getRemoteAddr(); 
		} 
		try { 
			result = java.net.InetAddress.getByName(result).getHostAddress(); 
		} catch (NoClassDefFoundError e) { 
		} catch (UnknownHostException e) { 
4
CodeRank
This code example shows how to use the following methods:
public class ThreadLocalRelaDataManager implements RelaDataManager { 
	 
	private static final Logger logger = LoggerFactory.getLogger(ThreadLocalRelaDataManager.class); 
	 
	private static final ThreadLocal<List<String>> nextFreeActs =
		new NamedThreadLocal<List<String>>("Freee Activity");
	 
	private static final ThreadLocal<List<Participant>> nextActParticipants =
		new NamedThreadLocal<List<Participant>>("Next Activity Participant");
	 
	private static final ThreadLocal<Map<Object, Object>> resources =
		new NamedThreadLocal<Map<Object, Object>>("Activity resources");
	 
	private static final String AUTO_ACT_LOGIC_RESULT = "autoActLogicResult";
	private static final String TRANSITION_EXPRESS_CONDITION = "transitionExpressCondition";
	private static final String MESSAGE_PARAMETER = "messageParameter";
 
 
	@Override 
	public Map<String, Object> getExpressConditions(long processInstId,
3
CodeRank