This is an automated email from the ASF dual-hosted git repository. gongchao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push: new 95905c8dc [improve] missing a generic (#1889) 95905c8dc is described below commit 95905c8dcb2e2728bc6be309d56aab38b37621f8 Author: crossoverJie <crossover...@gmail.com> AuthorDate: Tue Apr 30 21:50:30 2024 +0800 [improve] missing a generic (#1889) Co-authored-by: tomsun28 <tomsu...@outlook.com> --- .../collect/common/cache/ConnectionCommonCache.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java b/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java index 2601d28b3..6b2f0b9da 100644 --- a/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java +++ b/collector/src/main/java/org/apache/hertzbeat/collector/collect/common/cache/ConnectionCommonCache.java @@ -217,13 +217,11 @@ public class ConnectionCommonCache<T, C extends AbstractConnection<?>> { */ public void removeCache(T key) { timeoutMap.remove(key); - Object value = cacheMap.remove(key); - if (value instanceof AutoCloseable closeable) { - try { - closeable.close(); - } catch (Exception e) { - log.error("connection close error: {}.", e.getMessage(), e); - } + C value = cacheMap.remove(key); + try { + value.close(); + } catch (Exception e) { + log.error("connection close error: {}.", e.getMessage(), e); } } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@hertzbeat.apache.org For additional commands, e-mail: notifications-h...@hertzbeat.apache.org