fix: cancel the future in RemoteStorageHelper#forceDelete when TimeoutException happens by BenWhitehead · Pull Request #3136 · googleapis/java-storage · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

fix: cancel the future in RemoteStorageHelper#forceDelete when TimeoutException happens #3136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.google.cloud.storage.StorageException;
import com.google.cloud.storage.StorageOptions;
import com.google.common.base.Strings;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.time.Duration;
Expand All @@ -41,6 +42,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
Expand Down Expand Up @@ -153,11 +155,14 @@ public static Boolean forceDelete(Storage storage, String bucket, long timeout,
public static Boolean forceDelete(
Storage storage, String bucket, long timeout, TimeUnit unit, String userProject)
throws InterruptedException, ExecutionException {
ExecutorService executor = Executors.newSingleThreadExecutor();
ThreadFactory threadFactory =
new ThreadFactoryBuilder().setDaemon(true).setNameFormat("forceDelete-%s").build();
ExecutorService executor = Executors.newSingleThreadExecutor(threadFactory);
Future<Boolean> future = executor.submit(new DeleteBucketTask(storage, bucket, userProject));
try {
return future.get(timeout, unit);
} catch (TimeoutException ex) {
future.cancel(true);
return false;
} finally {
executor.shutdown();
Expand Down

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.