diff --git a/s3stream/src/main/java/com/automq/stream/s3/CompositeObjectReader.java b/s3stream/src/main/java/com/automq/stream/s3/CompositeObjectReader.java index c77a6a7c9d..4a0d5b43d9 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/CompositeObjectReader.java +++ b/s3stream/src/main/java/com/automq/stream/s3/CompositeObjectReader.java @@ -119,17 +119,14 @@ public synchronized void close0() { @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - CompositeObjectReader reader = (CompositeObjectReader) o; - return Objects.equals(objectMetadata.objectId(), reader.objectMetadata.objectId()); + // NOTE: DO NOT OVERRIDE THIS + return super.equals(o); } @Override public int hashCode() { - return Objects.hashCode(objectMetadata.objectId()); + // NOTE: DO NOT OVERRIDE THIS + return super.hashCode(); } private void asyncGetBasicObjectInfo(CompletableFuture basicObjectInfoCf) { diff --git a/s3stream/src/main/java/com/automq/stream/s3/ObjectReader.java b/s3stream/src/main/java/com/automq/stream/s3/ObjectReader.java index 231a015cf2..3cb30d3c70 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/ObjectReader.java +++ b/s3stream/src/main/java/com/automq/stream/s3/ObjectReader.java @@ -213,17 +213,14 @@ public synchronized void close0() { @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - DefaultObjectReader reader = (DefaultObjectReader) o; - return Objects.equals(metadata.objectId(), reader.metadata.objectId()); + // NOTE: DO NOT OVERRIDE THIS + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(metadata.objectId()); + // NOTE: DO NOT OVERRIDE THIS + return super.hashCode(); } } diff --git a/s3stream/src/main/java/com/automq/stream/s3/cache/AsyncLRUCache.java b/s3stream/src/main/java/com/automq/stream/s3/cache/AsyncLRUCache.java index 0201d0f0d9..baa52b2194 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/cache/AsyncLRUCache.java +++ b/s3stream/src/main/java/com/automq/stream/s3/cache/AsyncLRUCache.java @@ -22,6 +22,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * An asynchronous LRU cache that supports asynchronous value computation. + * + * @param key type + * @param value type, NOTE: V must not override equals and hashCode + */ public class AsyncLRUCache { private static final Logger LOGGER = LoggerFactory.getLogger(AsyncLRUCache.class); private final AsyncLRUCacheStats stats = AsyncLRUCacheStats.getInstance();