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

io.servicetalk.loadbalancer.Exceptions Maven / Gradle / Ivy

There is a newer version: 0.42.48
Show newest version
/*
 * Copyright © 2021-2023 Apple Inc. and the ServiceTalk project authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License 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 io.servicetalk.loadbalancer;

import io.servicetalk.client.api.ConnectionRejectedException;
import io.servicetalk.client.api.NoActiveHostException;
import io.servicetalk.client.api.NoAvailableHostException;
import io.servicetalk.concurrent.internal.ThrowableUtils;

final class Exceptions {

    static final class StacklessNoAvailableHostException extends NoAvailableHostException {
        private static final long serialVersionUID = 5942960040738091793L;

        private StacklessNoAvailableHostException(final String message) {
            super(message);
        }

        @Override
        public Throwable fillInStackTrace() {
            return this;
        }

        static StacklessNoAvailableHostException newInstance(String message, Class clazz, String method) {
            return ThrowableUtils.unknownStackTrace(new StacklessNoAvailableHostException(message), clazz, method);
        }
    }

    static final class StacklessNoActiveHostException extends NoActiveHostException {

        private static final long serialVersionUID = 7500474499335155869L;

        private StacklessNoActiveHostException(final String message) {
            super(message);
        }

        @Override
        public Throwable fillInStackTrace() {
            return this;
        }

        static StacklessNoActiveHostException newInstance(String message, Class clazz, String method) {
            return ThrowableUtils.unknownStackTrace(new StacklessNoActiveHostException(message), clazz, method);
        }
    }

    static final class StacklessConnectionRejectedException extends ConnectionRejectedException {
        private static final long serialVersionUID = -4940708893680455819L;

        private StacklessConnectionRejectedException(final String message) {
            super(message);
        }

        @Override
        public Throwable fillInStackTrace() {
            return this;
        }

        static StacklessConnectionRejectedException newInstance(String message, Class clazz, String method) {
            return ThrowableUtils.unknownStackTrace(new StacklessConnectionRejectedException(message), clazz, method);
        }
    }

    private Exceptions() {
        // no instances
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy