Skip to content

Commit

Permalink
feat(OSGI): OSGI
Browse files Browse the repository at this point in the history
Signed-off-by: yangzl <[email protected]>
  • Loading branch information
youngzil committed Jan 16, 2021
1 parent c79102b commit 4a3130f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
https://github.com/youngzil/quickstart-modular



- [Fat Jar学习](docs/Fat Jar学习.md)
- [模块化.md](docs/模块化.md)
- [模块化的实现、好处、框架](#模块化的实现、好处、框架)
- [OSGI(面向Java的动态模型系统)](#OSGI(面向Java的动态模型系统))




模块化相关,JAVA的模块化开发框架
classloader isolation framework
modular development framework
Expand Down
27 changes: 24 additions & 3 deletions docs/模块化.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
模块化的实现、好处、框架

- [模块化的实现、好处、框架](#模块化的实现、好处、框架)
- [OSGI(面向Java的动态模型系统)](#OSGI(面向Java的动态模型系统))


---------------------------------------------------------------------------------------------------------------------

## 模块化的实现、好处、框架

模块化框架:
osgi、jarslink、java9等
Expand Down Expand Up @@ -40,6 +40,27 @@ agentmain

---------------------------------------------------------------------------------------------------------------------

## OSGI(面向Java的动态模型系统)

OSGi(开放服务网关协议,Open Service Gateway Initiative)技术是Java动态化模块化系统的一系列规范。
[OSGI百度百科](https://baike.baidu.com/item/OSGI/16158)


ClassLoader可以实现的功能:
1、自定义加载类,实现切面功能、代码保护加解密等
2、
3、热部署功能


类层次划分,OSGi,热部署,代码加密等领域

Java模块化框架OSGI


比较常见的场景就是隔离,比如早些年比较火的Java模块化框架OSGI,把每个Jar包以Bundle的形式运行,每个Bundle有自己的类加载器(不同Bundle可以有相同的类名),Bundle与Bundle之间起到隔离的效果,同时如果一个Bundle依赖了另一个Bundle的某个类,那这个类的加载就委托给导出该类的BundleClassLoader进行加载;又比如Tomcat容器,每个WebApp有自己的ClassLoader,加载每个WebApp的ClassPath路径上的类,一旦遇到Tomcat自带的Jar包就委托给CommonClassLoader加载;对于公司的一些核心类库,可能会把字节码加密,这样加载类的时候就必须对字节码进行解密,可以通过findClass读取URL中的字节码,然后加密,最后把字节数组交给defineClass()加载。

资源隔离 热部署 代码保护



---------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 4a3130f

Please sign in to comment.