Class RenewalInfo

All Implemented Interfaces:
Serializable

public class RenewalInfo extends AcmeJsonResource
Renewal Information of a certificate.
Since:
3.0.0
See Also:
Draft:
This class is currently based on an RFC draft. It may be changed or removed without notice to reflect future changes to the draft. SemVer rules do not apply here.
  • Constructor Details

  • Method Details

    • getSuggestedWindowStart

      Returns the starting Instant of the time window the CA recommends for certificate renewal.
    • getSuggestedWindowEnd

      Returns the ending Instant of the time window the CA recommends for certificate renewal.
    • getExplanation

      An optional URL pointing to a page which may explain why the suggested renewal window is what it is.
    • renewalIsNotRequired

      public boolean renewalIsNotRequired(Instant instant)
      Checks if the given Instant is before the suggested time window, so a certificate renewal is not required yet.
      Parameters:
      instant - Instant to check
      Returns:
      true if the Instant is before the time window, false otherwise.
    • renewalIsRecommended

      public boolean renewalIsRecommended(Instant instant)
      Checks if the given Instant is within the suggested time window, and a certificate renewal is recommended.

      An Instant is deemed to be within the time window if it is equal to, or after getSuggestedWindowStart(), and before getSuggestedWindowEnd().

      Parameters:
      instant - Instant to check
      Returns:
      true if the Instant is within the time window, false otherwise.
    • renewalIsOverdue

      public boolean renewalIsOverdue(Instant instant)
      Checks if the given Instant is past the time window, and a certificate renewal is overdue.

      An Instant is deemed to be past the time window if it is equal to, or after getSuggestedWindowEnd().

      Parameters:
      instant - Instant to check
      Returns:
      true if the Instant is past the time window, false otherwise.
    • getRandomProposal

      public Optional<Instant> getRandomProposal(@Nullable TemporalAmount frequency)
      Returns a proposed Instant when the certificate related to this RenewalInfo should be renewed.

      This method is useful for setting alarms for renewal cron jobs. As a parameter, the frequency of the cron job is set. The resulting Instant is guaranteed to be executed in time, considering the cron job intervals.

      This method uses ThreadLocalRandom for random numbers. It is sufficient for most cases, as only an "earliest" Instant is returned, but the actual renewal process also depends on cron job execution times and other factors like system load.

      The result is empty if it is impossible to renew the certificate in time, under the given circumstances. This is either because the time window already ended in the past, or because the cron job would not be executed before the ending of the time window. In this case, it is recommended to renew the certificate immediately.

      Parameters:
      frequency - Frequency of the cron job executing the certificate renewals. May be null if there is no cron job, and the renewal is going to be executed exactly at the given Instant.
      Returns:
      Random Instant when the certificate should be renewed. This instant might be slightly in the past. In this case, start the renewal process at the next possible regular moment.
    • fetch

      public Optional<Instant> fetch() throws AcmeException
      Description copied from class: AcmeJsonResource
      Updates this resource, by fetching the current resource data from the server.
      Overrides:
      fetch in class AcmeJsonResource
      Returns:
      An Optional estimation when the resource status will change. If you are polling for the resource to complete, you should wait for the given instant before trying again. Empty if the server did not return a "Retry-After" header.
      Throws:
      AcmeException - if the resource could not be fetched.
      See Also: