Sentinel核心架构设计全景
整体架构 ┌────────────────────────────────────────┐ │ Sentinel Client │ ├────────────────────────────────────────┤ │ API Layer (SphU/SphO/Entry) │ ├────────────────────────────────────────┤ │ Slot Chain (责任链模式) │ │ ├─ NodeSelectorSlot │ │ ├─ ClusterBuilderSlot │ │ ├─ StatisticSlot │ │ ├─ AuthoritySlot │ │ ├─ SystemSlot │ │ ├─ FlowSlot │ │ └─ DegradeSlot │ ├────────────────────────────────────────┤ │ Metrics (滑动窗口统计) │ ├────────────────────────────────────────┤ │ Rule Manager (规则管理) │ └────────────────────────────────────────┘ 核心组件 1. Entry(资源入口) public abstract class Entry implements AutoCloseable { private final long createTime; private Node curNode; private Node originNode; private Throwable error; protected Entry(ResourceWrapper resourceWrapper, ProcessorSlot<Object> chain, Context context) { this.resourceWrapper = resourceWrapper; this.chain = chain; this.context = context; this.createTime = TimeUtil.currentTimeMillis(); } @Override public void close() { if (chain != null) { chain.exit(context, resourceWrapper, count, args); } } } 作用: ...