Skip to content
Closed
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions api/src/main/java/io/minio/MinioAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@ public CompletableFuture<ObjectWriteResponse> copyObject(CopyObjectArgs args)
checkArgs(args);
args.validateSse(this.baseUrl);

return CompletableFuture.supplyAsync(
() -> args.source().offset() != null && args.source().length() != null)
return supplyAsync(() -> args.source().offset() != null && args.source().length() != null)
.thenCompose(
condition -> {
if (condition) {
Expand Down Expand Up @@ -672,7 +671,7 @@ public CompletableFuture<ObjectWriteResponse> composeObject(ComposeObjectArgs ar
}

CompletableFuture<ObjectWriteResponse> completableFuture =
CompletableFuture.supplyAsync(
supplyAsync(
() -> {
Multimap<String, String> headers = newMultimap(args.extraHeaders());
headers.putAll(args.genHeaders());
Expand Down Expand Up @@ -712,7 +711,7 @@ public CompletableFuture<ObjectWriteResponse> composeObject(ComposeObjectArgs ar

int partNumber = 0;
CompletableFuture<Part[]> future =
CompletableFuture.supplyAsync(
supplyAsync(
() -> {
return new Part[partCount[0]];
});
Expand Down Expand Up @@ -3430,7 +3429,7 @@ public CompletableFuture<ObjectWriteResponse> uploadSnowballObjects(
NoSuchAlgorithmException, XmlParserException {
checkArgs(args);

return CompletableFuture.supplyAsync(
return supplyAsync(
() -> {
FileOutputStream fos = null;
BufferedOutputStream bos = null;
Expand Down Expand Up @@ -3580,7 +3579,7 @@ public CompletableFuture<PutObjectFanOutResponse> putObjectFanOut(PutObjectFanOu
checkArgs(args);
args.validateSse(this.baseUrl);

return CompletableFuture.supplyAsync(
return supplyAsync(
() -> {
// Build POST object data
String objectName =
Expand Down
11 changes: 8 additions & 3 deletions api/src/main/java/io/minio/S3Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -1204,7 +1205,7 @@ protected CompletableFuture<Integer> calculatePartCountAsync(List<ComposeSource>
long[] objectSize = {0};
int index = 0;

CompletableFuture<Integer> completableFuture = CompletableFuture.supplyAsync(() -> 0);
CompletableFuture<Integer> completableFuture = supplyAsync(() -> 0);
for (ComposeSource src : sources) {
index++;
final int i = index;
Expand Down Expand Up @@ -1282,6 +1283,10 @@ protected CompletableFuture<Integer> calculatePartCountAsync(List<ComposeSource>
return completableFuture;
}

protected <T> CompletableFuture<T> supplyAsync(Supplier<T> supplier) {
return CompletableFuture.supplyAsync(supplier);
}

/** Calculate part count of given compose sources. */
@Deprecated
protected int calculatePartCount(List<ComposeSource> sources)
Expand Down Expand Up @@ -2887,7 +2892,7 @@ private CompletableFuture<ObjectWriteResponse> putMultipartObjectAsync(
PartSource firstPartSource)
throws InsufficientDataException, InternalException, InvalidKeyException, IOException,
NoSuchAlgorithmException, XmlParserException {
return CompletableFuture.supplyAsync(
return supplyAsync(
() -> {
String uploadId = null;
ObjectWriteResponse response = null;
Expand Down Expand Up @@ -2986,7 +2991,7 @@ protected CompletableFuture<ObjectWriteResponse> putObjectAsync(
headers.putAll(args.genHeaders());
if (!headers.containsKey("Content-Type")) headers.put("Content-Type", contentType);

return CompletableFuture.supplyAsync(
return supplyAsync(
() -> {
try {
return partReader.getPart();
Expand Down