Do not clear DynamicContext content on removal, this has to be explicit
@@ -29,6 +29,8 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.openecard.common.util.FuturePromise;
import org.openecard.common.util.Promise;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
@@ -41,6 +43,8 @@ import org.openecard.common.util.Promise;
*/
public class DynamicContext {
+ private static final Logger LOG = LoggerFactory.getLogger(DynamicContext.class);
+
private static final InheritableThreadLocal<Map<String, DynamicContext>> LOCAL_MAP;
private final Map<String, Promise<Object>> context;
@@ -83,13 +87,13 @@ public class DynamicContext {
/**
* Removes the value from this thread.
- * This first clears the values saved in the context, and makes the context inaccessible for further invocations
+ * This does not clear the values saved in the context, it just makes the context inaccessible for further invocations
* of the {@link #getInstance(String)} method.
*
* @see ThreadLocal#remove()
*/
public static synchronized void remove() {
- LOCAL_MAP.get().clear();
+ LOG.debug("Removing DynamicContext which contains {} map entries.", LOCAL_MAP.get().size());
LOCAL_MAP.remove();
}
