org.xbib.helianthus.common.RequestContextThreadLocal Maven / Gradle / Ivy
package org.xbib.helianthus.common;
import io.netty.util.concurrent.FastThreadLocal;
import io.netty.util.internal.InternalThreadLocalMap;
final class RequestContextThreadLocal {
private static final FastThreadLocal context = new FastThreadLocal<>();
private RequestContextThreadLocal() {
}
@SuppressWarnings("unchecked")
static T get() {
return (T) context.get();
}
@SuppressWarnings("unchecked")
static T getAndSet(RequestContext ctx) {
final InternalThreadLocalMap map = InternalThreadLocalMap.get();
final RequestContext oldCtx = context.get(map);
context.set(map, ctx);
return (T) oldCtx;
}
static void set(RequestContext ctx) {
context.set(ctx);
}
static void remove() {
context.remove();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy