retainDuringRetry = cacheControl.getRetainDuringRetry();
retryFailedRetrieval = cacheControl.getRetryFailedRetrieval();
retryIntervalInMS = Period.inSeconds(cacheControl.getRetryInterval());
maxRetryCount = cacheControl.getRetryMaxCount();
Time currentTime = clock.getCurrentTime();
if (initialPolicy == null) {
// Calculate the expiration time based on the retry interval. A
// retry interval of 0 (or less) will result in the policy being
// retried immediately on the next request.
expirationTime = currentTime.addPeriod(retryIntervalInMS);
// The next attempt by the provider to retrieve the object is the
// first retry.
retryCount = 1;
} else {
Period timeToLive = Period.treatNonPositiveAsIndefinitely(
cacheControl.getTimeToLive() * 1000);
expirationTime = currentTime.addPeriod(timeToLive);
// No retrievals have failed yet so the next retrieval is not a
// retry.
retryCount = 0;
}