diff --git a/context-propagation/src/main/java/io/micrometer/context/ContextRegistry.java b/context-propagation/src/main/java/io/micrometer/context/ContextRegistry.java index f5f5239..122370c 100644 --- a/context-propagation/src/main/java/io/micrometer/context/ContextRegistry.java +++ b/context-propagation/src/main/java/io/micrometer/context/ContextRegistry.java @@ -149,8 +149,18 @@ public ContextRegistry registerThreadLocalAccessor(ThreadLocalAccessor access * Removes a {@link ThreadLocalAccessor}. * @param key under which the accessor got registered * @return {@code true} when accessor got successfully removed + * @deprecated use {@link ContextRegistry#removeThreadLocalAccessorForKey(Object)} instead */ public boolean removeThreadLocalAccessor(String key) { + return removeThreadLocalAccessorForKey(key); + } + + /** + * Removes a {@link ThreadLocalAccessor}. + * @param key under which the accessor got registered + * @return {@code true} when accessor got successfully removed + */ + public boolean removeThreadLocalAccessorForKey(Object key) { for (ThreadLocalAccessor existing : this.threadLocalAccessors) { if (existing.key().equals(key)) { return this.threadLocalAccessors.remove(existing);