Package com.azure.storage.common
Class ProgressReporter
- java.lang.Object
-
- com.azure.storage.common.ProgressReporter
-
public final class ProgressReporter extends Object
ProgressReporter
offers a convenient way to add progress tracking to a given Flux.
-
-
Constructor Summary
Constructors Constructor Description ProgressReporter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Flux<ByteBuffer>
addParallelProgressReporting(Flux<ByteBuffer> data, ProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress)
Adds parallel progress reporting functionality to the givenFlux
.static Flux<ByteBuffer>
addProgressReporting(Flux<ByteBuffer> data, ProgressReceiver progressReceiver)
Adds progress reporting functionality to the givenFlux
.
-
-
-
Method Detail
-
addProgressReporting
public static Flux<ByteBuffer> addProgressReporting(Flux<ByteBuffer> data, ProgressReceiver progressReceiver)
Adds progress reporting functionality to the givenFlux
. Each subscription (and therefore each retry) will rewind the progress reported so as not to over-report. The data reported will be the total amount of data emitted so far, or the "current position" of the Flux.- Parameters:
data
- The data whose transfer progress is to be tracked.progressReceiver
-ProgressReceiver
- Returns:
- A
Flux
that emits the same data as the source but calls a callback to report the total amount of data emitted so far.
-
addParallelProgressReporting
public static Flux<ByteBuffer> addParallelProgressReporting(Flux<ByteBuffer> data, ProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress)
Adds parallel progress reporting functionality to the givenFlux
. Each subscription (and therefore each retry) will rewind the progress reported so as not to over-report. The data reported will be the total amount of data emitted so far, or the "current position" of the Flux in parallel.- Parameters:
data
- The data whose transfer progress is to be tracked.progressReceiver
-ProgressReceiver
lock
- This lock will be instantiated by the operation initiating the whole transfer to coordinate each ProgressReporterImpl.totalProgress
- We need an AtomicLong to be able to update the value referenced. Because we are already synchronizing with the lock, we don't incur any additional performance hit here by the synchronization.- Returns:
- A
Flux
that emits the same data as the source but calls a callback to report the total amount of data emitted so far.
-
-