Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aether-users] Distinguishing between user cancellation of the download and real download errors

Hi,

I am wondering if it is possible to distinguish between cancellation of a download and other transfer errors when setting Resolution Error Policy?

We have the following code:

            // Try to update any models older than 1 hour.
            onlineSession.setUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_INTERVAL + ":" + HOURS.toMinutes(1));
            // Do not retry downloading missing models until the update interval has elapsed.
            // Do not retry downloading models after a failed download.
            onlineSession.setResolutionErrorPolicy(new SimpleResolutionErrorPolicy(CACHE_ALL));

Our problem occurs when the user cancels the download. To communicate this we have our TransferListener throw a TransferCancelledException. This is then considered to be a transfer error (included in the CACHE_ALL bit mask). The user will not be allowed to restart/continue the download until an hour has elapsed.

I notice that both the "resolver-status.properties" and the "filename.lastUpdated" files indicate that the transfer was interrupted due to a cancellation. Is there a way for me to distinguish between cancellation and some transfer error programmatically (without parsing either of the files, the comment in the files warns that the file format may change without notice)?

Alternatively is there some other ResolutionErrorPolicy/BitMask combination which will not cache a file in the event of a cancellation?

Many thanks,
Simon Laffoy

Back to the top