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

com.undefinedlabs.scope.deps.okhttp3.internal.connection.RouteDatabase Maven / Gradle / Ivy

Go to download

Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly identify, troubleshoot and fix failed builds. This artifact contains dependencies for Scope.

There is a newer version: 0.14.0-beta.2
Show newest version
package com.undefinedlabs.scope.deps.okhttp3.internal.connection;

import com.undefinedlabs.scope.deps.okhttp3.Route;

import java.util.LinkedHashSet;
import java.util.Set;

public final class RouteDatabase {
    private final Set failedRoutes = new LinkedHashSet<>();

    /** Records a failure connecting to {@code failedRoute}. */
    public synchronized void failed(Route failedRoute) {
        failedRoutes.add(failedRoute);
    }

    /** Records success connecting to {@code route}. */
    public synchronized void connected(Route route) {
        failedRoutes.remove(route);
    }

    /** Returns true if {@code route} has failed recently and should be avoided. */
    public synchronized boolean shouldPostpone(Route route) {
        return failedRoutes.contains(route);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy