-
Notifications
You must be signed in to change notification settings - Fork 8.1k
How to Use
jialianglinjl edited this page Jun 22, 2018
·
36 revisions
- "Hello world"
- [Resource]
- How it works
- Flow Control & Shapping
- Flow Shaping: Pace Limiter
- Flow Shaping: Warm Up
- Degrade
- System Protection
- Admin Console
- Rules Management
- Extension
- [Adapt to Other Frameworks]
- Demos
- Trouble Shooting & Logs
The following is a basic “Hello World” implementation of a resource definition:
public void helloWorld() {
Entry entry = null;
try {
// Resource name that can identify the protected logic
entry = SphU.entry("HelloWorld");
/**
* BIZ Logic that need protection
*/
} catch (BlockException e) {
/**
* Fail to enter, blocked by rules
*/
} finally {
if (entry != null) {
entry.exit();
}
}
}
or we can also use 'if' and 'else' to define resource:
public void helloWorld(){
if(SphO.entry("HelloWorld")){
try {
/**
* BIZ Logic that need protection
*/
} finally {
SphO.exit();
}
}else{
/**
* Fail to enter, blocked by rules
*/
}
}
-
文档
-
Documents
- Read Me
- Introduction
- How to Use
- How it Works
- Flow Control
- Parameter Flow Control
- Cluster Flow Control
- API Gateway Flow Control
- Circuit Breaking
- Adaptive System Protection
- Metrics
- General Configuration
- Dynamic Rule Configuration
- Dashboard
- Integrations with open-source frameworks
- Contribution Guideline