Business Framework Plugins
Introduction
The business framework provides a plugin mechanism. Plugins are used to intercept action requests.
With plugins, you can extend many useful capabilities depending on your imagination. For example:
- Record actions with long execution time.
- Find which business methods are called most frequently.
The framework already provides built-in plugins, and plugin count will continue to increase over time. Developers can extend plugins that fit their own business needs.
Different plugins focus on different concerns. For example, combining invocation and monitoring plugins can help identify performance issues during development. With proper plugin usage, issues can be discovered and prevented earlier in the development phase.
Built-in Plugins Provided by Framework
| PluginName | Description |
|---|---|
| DebugInOut | Observe business execution duration, parameters/return values, and locate business code. |
| StatActionInOut | Action invocation statistics plugin Developers can analyze hot methods and time-consuming methods using these statistics for precise optimization. |
| ThreadMonitorInOut | Business thread monitoring plugin, mainly focusing on: 1. Action execution count per business thread 2. Average execution time 3. Number of queued tasks in current business thread |
| TimeRangeInOut | Time-range invocation statistics plugin; action statistics per hour in a day, mainly focusing on business consumption across time ranges each day. It can collect full 24-hour stats, or specific ranges; it can collect per-minute stats inside each hour, and can also specify minute windows (for example, count only 0~30 minutes and skip 30~60 minutes). |
How to Use
Add plugins to the business framework. Plugins added earlier execute earlier during action processing.
public class MyLogicServer implements LogicServer {
@Override
public void settingBarSkeletonBuilder(BarSkeletonBuilder builder) {
builder.addInOut(new DebugInOut());
builder.addInOut(new StatActionInOut());
builder.addInOut(new ThreadMonitorInOut());
builder.addInOut(new TimeRangeInOut());
}
}
How to Extend
public final class MyInOut implements ActionMethodInOut {
@Override
public void fuckIn(final FlowContext flowContext) {
// your code
}
@Override
public void fuckOut(final FlowContext flowContext) {
// your code
}
}