FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: make ParallelCompositeUploadBlobWriteSessionConfig.ExecutorSupplier#cachedPool a singleton by BenWhitehead · Pull Request #2691 · googleapis/java-storage · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private ExecutorSupplier() {}
*/
@BetaApi
public static ExecutorSupplier cachedPool() {
return new CachedSupplier();
return CachedSupplier.INSTANCE;
}

/**
Expand Down Expand Up @@ -529,12 +529,18 @@ private void writeObject(ObjectOutputStream out) throws IOException {

private static class CachedSupplier extends ExecutorSupplier implements Serializable {
private static final long serialVersionUID = 7768210719775319260L;
private static final CachedSupplier INSTANCE = new CachedSupplier();

@Override
Executor get() {
ThreadFactory threadFactory = newThreadFactory();
return Executors.newCachedThreadPool(threadFactory);
}

/** prevent java serialization from using a new instance */
private Object readResolve() {
return INSTANCE;
}
}

private static class FixedSupplier extends ExecutorSupplier implements Serializable {
Expand Down

Back | FazBrowse Home | New Git URL