Lazy use of Reactor Scheduler in DefaultPartHttpMessageReader

Closes gh-33218
This commit is contained in:
rstoyanchev 2024-07-15 15:10:30 +01:00
parent 50906e7fcb
commit 39c040005e
1 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -66,7 +66,8 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
private int maxParts = -1;
private Scheduler blockingOperationScheduler = Schedulers.boundedElastic();
@Nullable
private Scheduler blockingOperationScheduler;
private FileStorage fileStorage = FileStorage.tempDirectory(this::getBlockingOperationScheduler);
@ -152,7 +153,8 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
}
private Scheduler getBlockingOperationScheduler() {
return this.blockingOperationScheduler;
return (this.blockingOperationScheduler != null ?
this.blockingOperationScheduler : Schedulers.boundedElastic());
}
/**
@ -206,7 +208,7 @@ public class DefaultPartHttpMessageReader extends LoggingCodecSupport implements
else {
return PartGenerator.createPart(partsTokens,
this.maxInMemorySize, this.maxDiskUsagePerPart,
this.fileStorage.directory(), this.blockingOperationScheduler);
this.fileStorage.directory(), getBlockingOperationScheduler());
}
});
});