Deprecate update() and AcmeRetryAfterException

pull/168/head
Richard Körber 2024-08-18 11:42:50 +02:00
parent 05d826d83e
commit 171ee474c0
No known key found for this signature in database
GPG Key ID: AAB9FD19C78AA3E0
3 changed files with 8 additions and 0 deletions

View File

@ -123,7 +123,11 @@ public abstract class AcmeJsonResource extends AcmeResource {
* {@link AcmeRetryAfterException#getRetryAfter()}. Note that the status of
* the resource is updated even if this exception was thrown.
* @see #fetch()
* @deprecated Use {@link #fetch()} instead. It returns the retry-after value as
* {@link Optional} instead of throwing an {@link AcmeRetryAfterException}. This
* method will be removed in a future version.
*/
@Deprecated
public void update() throws AcmeException {
var retryAfter = fetch();
if (retryAfter.isPresent()) {

View File

@ -25,7 +25,10 @@ import org.shredzone.acme4j.AcmeJsonResource;
* Note: Prefer to use {@link AcmeJsonResource#fetch()}. Invoking
* {@link AcmeJsonResource#update()} and catching this exception is unnecessary
* complicated and a legacy from acme4j v2 which will disappear in a future release.
*
* @deprecated Will be removed in a future version.
*/
@Deprecated
public class AcmeRetryAfterException extends AcmeException {
private static final long serialVersionUID = 4461979121063649905L;

View File

@ -6,6 +6,7 @@ This document will help you migrate your code to the latest _acme4j_ version.
- To be futureproof, you should wait for your `Order` resource's state to become `READY` before invoking `Order.execute()`. Most CAs change to the `READY` state immediately, but this behavior is not specified in RFC8555. Future CA implementations may stay in `PENDING` state for a short while, and would return an error if `execute()` is invoked too early. Also see the [example](example.md#the-main-workflow) for how wait for the `READY` state.
- There are new methods `waitForCompletion()` and `waitUntilReady()` that will do the synchronous busy wait for the resource state for you. It will remove a lot of boilerplate code that is also bug prone if implemented individually. If you use synchronous polling and waiting (like shown in the example code), I recommend to change to these methods instead of waiting for the correct state yourself. See the [example](example.md) for how to use the new methods.
- Marked `update()` (and `AcmeRetryAfterException`) as deprecated now. Please use `fetch()` instead, it returns the retry-after time as `Optional` instead of throwing an `AcmeRetryAfterException`.
## Migration to Version 3.3.0