From d7b73f06ccddbaa421b56f789dd73721b621b7c0 Mon Sep 17 00:00:00 2001 From: "Xu Han@AutoMQ" Date: Fri, 22 Nov 2024 17:15:44 +0800 Subject: [PATCH] chore(stream): move asyncsemaphore to util (#2173) Signed-off-by: Robin Han --- .../com/automq/stream/s3/cache/blockcache/DataBlockCache.java | 1 + .../stream/{s3/cache/blockcache => utils}/AsyncSemaphore.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename s3stream/src/main/java/com/automq/stream/{s3/cache/blockcache => utils}/AsyncSemaphore.java (97%) diff --git a/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/DataBlockCache.java b/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/DataBlockCache.java index 84244603a5..382fe59e90 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/DataBlockCache.java +++ b/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/DataBlockCache.java @@ -18,6 +18,7 @@ import com.automq.stream.s3.metrics.S3StreamMetricsManager; import com.automq.stream.s3.metrics.stats.StorageOperationStats; import com.automq.stream.s3.network.ThrottleStrategy; +import com.automq.stream.utils.AsyncSemaphore; import com.automq.stream.utils.FutureUtil; import com.automq.stream.utils.Time; import com.automq.stream.utils.threads.EventLoop; diff --git a/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/AsyncSemaphore.java b/s3stream/src/main/java/com/automq/stream/utils/AsyncSemaphore.java similarity index 97% rename from s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/AsyncSemaphore.java rename to s3stream/src/main/java/com/automq/stream/utils/AsyncSemaphore.java index 9b7936546b..ec50c523ae 100644 --- a/s3stream/src/main/java/com/automq/stream/s3/cache/blockcache/AsyncSemaphore.java +++ b/s3stream/src/main/java/com/automq/stream/utils/AsyncSemaphore.java @@ -9,7 +9,7 @@ * by the Apache License, Version 2.0 */ -package com.automq.stream.s3.cache.blockcache; +package com.automq.stream.utils; import com.automq.stream.utils.threads.EventLoop; @@ -21,7 +21,7 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; -class AsyncSemaphore { +public class AsyncSemaphore { private static final Logger LOGGER = LoggerFactory.getLogger(AsyncSemaphore.class); private final Queue tasks = new LinkedList<>(); private long permits;