
com.ebmwebsourcing.easycommons.thread.InheritableThreadContext Maven / Gradle / Ivy
The newest version!
/**
* Copyright (c) 2010-2012 EBM WebSourcing, 2012-2023 Linagora
*
* This program/library is free software: you can redistribute it and/or modify
* it under the terms of the New BSD License (3-clause license).
*
* This program/library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the New BSD License (3-clause license)
* for more details.
*
* You should have received a copy of the New BSD License (3-clause license)
* along with this program/library; If not, see http://directory.fsf.org/wiki/License:BSD_3Clause/
* for the New BSD License (3-clause license).
*/
package com.ebmwebsourcing.easycommons.thread;
/**
* @author Olivier Fabre - EBM WebSourcing
*/
public final class InheritableThreadContext {
private static InheritableThreadLocal> itl;
static {
reset();
}
private InheritableThreadContext() {
}
public static final void reset() {
itl = new InheritableThreadLocal>() {
@Override
protected ConcurrentHashMapWithDefaults initialValue() {
return new ConcurrentHashMapWithDefaults();
}
@Override
protected ConcurrentHashMapWithDefaults childValue(
ConcurrentHashMapWithDefaults parentValue) {
ConcurrentHashMapWithDefaults childValue = new ConcurrentHashMapWithDefaults(
parentValue);
return childValue;
}
};
}
public static final ConcurrentHashMapWithDefaults getParameters() {
return itl.get();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy