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

com.github.df.restypass.cb.CircuitBreaker Maven / Gradle / Ivy

The newest version!
package com.github.df.restypass.cb;

import com.github.df.restypass.command.RestyCommand;
import com.github.df.restypass.enums.CircuitBreakerStatus;
import com.github.df.restypass.event.EventConsumer;
import com.github.df.restypass.lb.server.ServerInstance;

import java.util.Set;

/**
 * 断路器
 * Created by darrenfu on 17-7-22.
 */
@SuppressWarnings("unused")
public interface CircuitBreaker extends EventConsumer {

    /**
     * 启动断路器.
     */
    void start();

    /**
     * 停止断路器.
     */
    void end();

    /**
     * 是否通过
     *
     * @param restyCommand   the resty command
     * @param serverInstance the server instance
     * @return the boolean
     */
    boolean shouldPass(RestyCommand restyCommand, ServerInstance serverInstance);

    /**
     * 获取短路的server instance id 列表
     *
     * @return the broken server
     */
    Set getBrokenServer();

    /**
     * Sets status.
     *
     * @param restyCommand the resty command
     * @param status       the status
     */
    void setStatus(RestyCommand restyCommand, CircuitBreakerStatus status);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy