Skip to content

Commit

Permalink
sample deprecation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasobol-msft committed Jun 21, 2022
1 parent 3913164 commit 460f7b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.azure.communication.callingserver.implementation.Constants.ContentDownloader;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.ProgressListener;

import java.util.Locale;

Expand Down Expand Up @@ -68,12 +69,25 @@ public ProgressReceiver getProgressReceiver() {
*
* @param progressReceiver The {@link ProgressReceiver}.
* @return The ParallelDownloadOptions object itself.
* @deprecated Use {@link #setProgressListener(ProgressListener)}
*/
@Deprecated
public ParallelDownloadOptions setProgressReceiver(ProgressReceiver progressReceiver) {
this.progressReceiver = progressReceiver;
return this;
}

/**
* Sets the {@link com.azure.core.util.ProgressListener}.
*
* @param progressListener The {@link ProgressReceiver}.
* @return The ParallelDownloadOptions object itself.
*/
public ParallelDownloadOptions setProgressListener(ProgressListener progressListener) {
this.progressReceiver = progressListener::handleProgress;
return this;
}

/**
* Gets the maximum number of parallel requests that will be issued at any given time.
* @return The max concurrency value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@
* Note that any method accepting a {@link ParallelDownloadOptions} will use
* the {@code ProgressReceiver} specified there and will handle the logic to coordinate the reporting between parallel
* operations.
*
*/
@FunctionalInterface
public interface ProgressReceiver extends com.azure.core.util.ProgressReceiver {
public interface ProgressReceiver extends com.azure.core.util.ProgressListener {

/**
* The callback function invoked as progress is reported.
*
* @param bytesTransferred The total number of bytes transferred during this transaction.
* @deprecated This type is replaced by {@link com.azure.core.util.ProgressListener}. This API will be removed
* in future versions.
*/
@Deprecated
void reportProgress(long bytesTransferred);

@Override
default void handleProgress(long progress) {
reportProgress(progress);
}
}

0 comments on commit 460f7b2

Please sign in to comment.