Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 优化熔断插件实现,解决用户通配API内存占用过高问题 #538

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,54 @@

package com.tencent.polaris.circuitbreak.api;

import java.io.Closeable;

import com.tencent.polaris.api.plugin.circuitbreaker.ResourceStat;
import com.tencent.polaris.api.plugin.circuitbreaker.entity.Resource;
import com.tencent.polaris.circuitbreak.api.pojo.CheckResult;
import com.tencent.polaris.circuitbreak.api.pojo.FunctionalDecoratorRequest;
import com.tencent.polaris.circuitbreak.api.pojo.InvokeContext;

public interface CircuitBreakAPI {

/**
* check and acquire circuitbreaker
*
* @param resource
* @return pass or not, and fallback config if needed
*/
CheckResult check(Resource resource);

/**
* report the resource invoke result
*
* @param reportStat
*/
void report(ResourceStat reportStat);


/**
* make the function decorator
*
* @param functionalDecoratorRequest
* @return decorator
*/
FunctionalDecorator makeFunctionalDecorator(FunctionalDecoratorRequest functionalDecoratorRequest);

/**
* make the invoke handler
* @param requestContext
* @return InvokeHandler
*/
InvokeHandler makeInvokeHandler(InvokeContext.RequestContext requestContext);
public interface CircuitBreakAPI extends AutoCloseable, Closeable {

/**
* check and acquire circuitbreaker
*
* @param resource
* @return pass or not, and fallback config if needed
*/
CheckResult check(Resource resource);

/**
* report the resource invoke result
*
* @param reportStat
*/
void report(ResourceStat reportStat);


/**
* make the function decorator
*
* @param functionalDecoratorRequest
* @return decorator
*/
FunctionalDecorator makeFunctionalDecorator(FunctionalDecoratorRequest functionalDecoratorRequest);

/**
* make the invoke handler
* @param requestContext
* @return InvokeHandler
*/
InvokeHandler makeInvokeHandler(InvokeContext.RequestContext requestContext);

/**
* 清理并释放资源
*/
void destroy();

@Override
default void close() {
destroy();
}
}
Loading
Loading