public class SDKProgressPublisher extends Object
Constructor and Description |
---|
SDKProgressPublisher() |
Modifier and Type | Method and Description |
---|---|
protected static ExecutorService |
getExecutorService()
Returns the executor service used for performing the callbacks.
|
static Future<?> |
publishProgress(ProgressListener listener,
ProgressEventType type)
Used to deliver a progress event to the given listener.
|
static Future<?> |
publishRequestBytesTransferred(ProgressListener listener,
long bytes)
Convenient method to publish a request byte transfer event to the given
listener.
|
static Future<?> |
publishRequestContentLength(ProgressListener listener,
long bytes)
Convenient method to publish a request content length event to the given
listener.
|
static Future<?> |
publishRequestReset(ProgressListener listener,
long bytesReset)
Convenient method to publish a request reset event to the given listener.
|
static Future<?> |
publishResponseBytesDiscarded(ProgressListener listener,
long bytesDiscarded)
Convenient method to publish a response bytes discard event to the given listener.
|
static Future<?> |
publishResponseBytesTransferred(ProgressListener listener,
long bytes)
Convenient method to publish a response byte transfer event to the given
listener.
|
static Future<?> |
publishResponseContentLength(ProgressListener listener,
long bytes)
Convenient method to publish a response content length event to the given
listener.
|
static Future<?> |
publishResponseReset(ProgressListener listener,
long bytesReset)
Convenient method to publish a response reset event to the given listener.
|
protected static Future<?> |
setLatestFutureTask(Future<?> f) |
static void |
shutdown(boolean now)
Can be used to shutdown the (legacy) executor.
|
static void |
waitTillCompletion()
Deprecated.
|
public static Future<?> publishProgress(ProgressListener listener, ProgressEventType type)
public static Future<?> publishRequestContentLength(ProgressListener listener, long bytes)
listener
- must not be null or else the publication will be skippedbytes
- must be non-negative or else the publication will be skippedpublic static Future<?> publishResponseContentLength(ProgressListener listener, long bytes)
listener
- must not be null or else the publication will be skippedbytes
- must be non-negative or else the publication will be skippedpublic static Future<?> publishRequestBytesTransferred(ProgressListener listener, long bytes)
listener
- must not be null or else the publication will be skippedbytes
- must be non-negative or else the publication will be skippedpublic static Future<?> publishResponseBytesTransferred(ProgressListener listener, long bytes)
listener
- must not be null or else the publication will be skippedbytes
- must be non-negative or else the publication will be skippedpublic static Future<?> publishRequestReset(ProgressListener listener, long bytesReset)
listener
- must not be null or else the publication will be skippedbytesReset
- must be non-negative or else the publication will be skippedpublic static Future<?> publishResponseReset(ProgressListener listener, long bytesReset)
public static Future<?> publishResponseBytesDiscarded(ProgressListener listener, long bytesDiscarded)
protected static ExecutorService getExecutorService()
@Deprecated public static void waitTillCompletion() throws InterruptedException, ExecutionException
public static void shutdown(boolean now)
However, the recommended best practice is to always make use of progress
listeners that are short-lived (ie do not block) and are subclasses of
either SyncProgressListener
or
S3SyncProgressListener
. That way, the progress publisher
(legacy) thread will never be activated in the first place.
now
- true if shutdown now; false otherwise.Copyright © 2019. All rights reserved.