Class ParallelDownloadOptions
java.lang.Object
com.azure.communication.callingserver.models.ParallelDownloadOptions
This class contains configuration used to parallelize data transfer operations. Note that not all values are used
by every method which accepts this type. Please refer to the javadoc on specific methods for these cases.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertInBounds
(String param, long value, long min, long max) Asserts that the specified number is in the valid range.long
Gets the block size (chunk size) to transfer at a time.int
Gets the maximum number of parallel requests that will be issued at any given time.Gets the Progress listener for parallel reportingsetBlockSize
(Long blockSize) Sets the block size.setMaxConcurrency
(Integer maxConcurrency) setProgressListener
(ProgressListener progressListener) Sets theProgressListener
.
-
Constructor Details
-
ParallelDownloadOptions
public ParallelDownloadOptions()Creates a newParallelDownloadOptions
with default parameters applied.
-
-
Method Details
-
getBlockSize
public long getBlockSize()Gets the block size (chunk size) to transfer at a time.- Returns:
- The block size.
-
setBlockSize
Sets the block size. For upload, The block size is the size of each block that will be staged. This value also determines the number of requests that need to be made. This parameter also determines the size that each buffer uses when buffering is required and consequently amount of memory consumed by such methods may be up to blockSize * numBuffers. For download to file, the block size is the size of each data chunk returned from the service. For both applications, If block size is large, upload will make fewer network calls, but each individual call will send more data and will therefore take longer.- Parameters:
blockSize
- The block size.- Returns:
- The ParallelDownloadOptions object itself.
-
getProgressListener
Gets the Progress listener for parallel reporting- Returns:
- The progress listener
-
setProgressListener
Sets theProgressListener
.- Parameters:
progressListener
- TheProgressListener
.- Returns:
- The ParallelDownloadOptions object itself.
-
getMaxConcurrency
public int getMaxConcurrency()Gets the maximum number of parallel requests that will be issued at any given time.- Returns:
- The max concurrency value.
-
setMaxConcurrency
- Parameters:
maxConcurrency
- The maximum number of parallel requests that will be issued at any given time as a part of a single parallel transfer. This value applies per api. For example, if two calls to uploadFromFile are made at the same time, and each specifies a maxConcurrency of 5, there may be up to 10 outstanding, concurrent requests, up to 5 for each of the upload operations. For buffered uploads only, the maximum number of buffers to be allocated as part of the transfer will bemaxConcurrency + 1
. In those cases, memory will be allocated lazily as needed. The amount of memory consumed by methods which buffer may be up to blockSize * maxConcurrency. In general, upload methods which do not accept a length parameter must perform some buffering.- Returns:
- The ParallelDownloadOptions object itself.
-
assertInBounds
Asserts that the specified number is in the valid range. The range is inclusive.- Parameters:
param
- Name of the parametervalue
- Value of the parametermin
- The minimum allowed valuemax
- The maximum allowed value- Throws:
IllegalArgumentException
- Ifvalue
is less thanmin
orvalue
is greater thanmax
.
-