-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
binghe001
committed
Oct 3, 2024
1 parent
bc7fb3b
commit 255c7e8
Showing
6 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: 第12节:网关上下文顶层抽象类设计 | ||
pay: https://articles.zsxq.com/id_k7krp1hm5esd.html | ||
--- | ||
|
||
# 《高性能Polaris网关》通用模型-第12节:网关上下文顶层抽象类设计 | ||
|
||
作者:冰河 | ||
<br/>星球:[http://m6z.cn/6aeFbs](http://m6z.cn/6aeFbs) | ||
<br/>博客:[https://binghe.gitcode.host](https://binghe.gitcode.host) | ||
<br/>文章汇总:[https://binghe.gitcode.host/md/all/all.html](https://binghe.gitcode.host/md/all/all.html) | ||
<br/>源码获取地址:[https://t.zsxq.com/0dhvFs5oR](https://t.zsxq.com/0dhvFs5oR) | ||
|
||
> 沉淀,成长,突破,帮助他人,成就自我。 | ||
* 本章难度:★★☆☆☆ | ||
* 本节重点:对高性能Polaris网关的上下文顶层抽象类进行设计,从全局角度掌握高性能Polaris网关上下文顶层抽象类的设计。重点掌握整体调用链路的设计思路和设计方法,并能够将其灵活应用到自身实际项目中。 | ||
|
||
**大家好,我是冰河~~** | ||
|
||
在网关的上下文设计中,已经完成了网关上下文属性顶层接口、抽象类、工厂类和实现类的设计。为最终设计通用模型中网关的核心上下文做好了铺垫,同时,也设计了网关上下文顶层抽象接口,为整个网关上下文的整体框架设计奠定了基础。 | ||
|
||
## 一、前言 | ||
|
||
在前面的文章中,已经对高性能Polaris网关的请求与响应模型的顶层接口和实现进行了设计,对调用链路的顶层接口与抽象类模型进行了设计和实现,又对网关服务的定义与实例模型和服务配置的缓存接口与实现类进行了设计。随后,从网关上下文的角度,对网关上下文的顶层接口、抽象类工厂类和具体实现类进行了设计。同时,又对网关上下文的顶层抽象接口进行了设计。接下来,就对网关上下文顶层抽象类进行设计。 | ||
|
||
## 二、本节诉求 | ||
|
||
对高性能Polaris网关的上下文顶层抽象类进行设计,从全局角度掌握高性能Polaris网关上下文顶层抽象类的设计。重点掌握整体调用链路的设计思路和设计方法,并能够将其灵活应用到自身实际项目中。 | ||
|
||
## 三、类结构设计 | ||
|
||
网关上下文顶层抽象类设计如图12-1所示。 | ||
|
||
<div align="center"> | ||
<img src="https://binghe.gitcode.host/images/project/gateway/2024-10-03-001.png?raw=true" width="70%"> | ||
<br/> | ||
</div> | ||
|
||
可以看到,在网关上下文的设计中,新增了AbstractContext顶层抽象类,主要实现了PolarisContext接口。 | ||
|
||
## 四、编码实现 | ||
|
||
AbstractContext顶层抽象类是网关上下文的顶层抽象类。 | ||
|
||
源码详见:polaris-context工程下的io.binghe.polaris.context.ctx.AbstractContext。 | ||
|
||
## 查看完整文章 | ||
|
||
加入[冰河技术](https://public.zsxq.com/groups/48848484411888.html)知识星球,解锁完整技术文章、小册、视频与完整代码 |