All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.core.exception.RetryableException Maven / Gradle / Ivy

Go to download

A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.

There is a newer version: 2.5.20
Show newest version
/*
 * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package software.amazon.awssdk.core.exception;

import software.amazon.awssdk.annotations.SdkPublicApi;

/**
 * Extension of {@link SdkException} that can be used by clients to
 * explicitly have an exception retried. This exception will never be
 * thrown by the SDK unless explicitly used by the client.
 *
 * See {@link NonRetryableException} for marking non-retryable exceptions.
 */
@SdkPublicApi
public final class RetryableException extends SdkException {

    protected RetryableException(Builder b) {
        super(b);
    }

    @Override
    public boolean retryable() {
        return true;
    }

    @Override
    public Builder toBuilder() {
        return new BuilderImpl(this);
    }

    public static Builder builder() {
        return new BuilderImpl();
    }

    public interface Builder extends SdkException.Builder {
        @Override
        Builder message(String message);

        @Override
        Builder cause(Throwable cause);

        @Override
        RetryableException build();
    }

    protected static final class BuilderImpl extends SdkException.BuilderImpl implements Builder {

        protected BuilderImpl() {}

        protected BuilderImpl(RetryableException ex) {
            super(ex);
        }

        @Override
        public Builder message(String message) {
            this.message = message;
            return this;
        }

        @Override
        public Builder cause(Throwable cause) {
            this.cause = cause;
            return this;
        }

        @Override
        public RetryableException build() {
            return new RetryableException(this);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy