Skip to content

Commit

Permalink
update codes and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dunwu committed Dec 1, 2020
1 parent de3098f commit ae82bf0
Show file tree
Hide file tree
Showing 24 changed files with 3,361 additions and 228 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@
>
> Nginx 是目前最流行的反向代理服务器,也常用于负载均衡。
- [Tomcat](docs/server/tomcat.md)
- [Tomcat 应用指南](docs/server/Tomcat应用指南.md)
- [Tomcat 连接器](docs/server/Tomcat连接器.md)
- [Tomcat 容器](docs/server/Tomcat容器.md)
- [Tomcat 优化](docs/server/Tomcat优化.md)
- [Jetty](docs/server/jetty.md)
- [Nginx](https://github.com/dunwu/nginx-tutorial) 📚

Expand Down
27 changes: 27 additions & 0 deletions assets/server/tomcat/Lifecycle.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>JAVA</ID>
<OriginalElement>org.apache.catalina.Lifecycle</OriginalElement>
<nodes>
<node x="0.0" y="0.0">org.apache.catalina.Lifecycle</node>
<node x="419.0" y="0.0">org.apache.catalina.LifecycleState</node>
<node x="0.0" y="662.0">org.apache.catalina.util.LifecycleBase</node>
</nodes>
<notes />
<edges>
<edge source="org.apache.catalina.util.LifecycleBase" target="org.apache.catalina.Lifecycle">
<point x="0.0" y="-149.5" />
<point x="0.0" y="306.0" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="0.799184505606524" x="333.8692602040817" y="504.2742346938775" />
<SelectedNodes />
<Categories>
<Category>Methods</Category>
<Category>Properties</Category>
<Category>Fields</Category>
</Categories>
<SCOPE>All</SCOPE>
<VISIBILITY>public</VISIBILITY>
</Diagram>

76 changes: 76 additions & 0 deletions assets/server/tomcat/ProtocolHandler.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>JAVA</ID>
<OriginalElement>org.apache.coyote.ajp.AjpAprProtocol</OriginalElement>
<nodes>
<node x="994.0" y="258.0">org.apache.coyote.ajp.AjpNioProtocol</node>
<node x="969.5" y="172.0">org.apache.coyote.ajp.AbstractAjpProtocol</node>
<node x="512.0" y="258.0">org.apache.coyote.http11.Http11NioProtocol</node>
<node x="1215.0" y="258.0">org.apache.coyote.ajp.AjpAprProtocol</node>
<node x="630.0" y="0.0">org.apache.coyote.ProtocolHandler</node>
<node x="261.0" y="258.0">org.apache.coyote.http11.Http11AprProtocol</node>
<node x="236.5" y="172.0">org.apache.coyote.http11.AbstractHttp11Protocol</node>
<node x="0.0" y="258.0">org.apache.coyote.http11.Http11Nio2Protocol</node>
<node x="625.0" y="86.0">org.apache.coyote.AbstractProtocol</node>
<node x="763.0" y="258.0">org.apache.coyote.ajp.AjpNio2Protocol</node>
</nodes>
<notes />
<edges>
<edge source="org.apache.coyote.http11.Http11AprProtocol" target="org.apache.coyote.http11.AbstractHttp11Protocol">
<point x="0.0" y="-18.0" />
<point x="0.0" y="18.0" />
</edge>
<edge source="org.apache.coyote.AbstractProtocol" target="org.apache.coyote.ProtocolHandler">
<point x="0.0" y="-18.0" />
<point x="0.0" y="18.0" />
</edge>
<edge source="org.apache.coyote.ajp.AbstractAjpProtocol" target="org.apache.coyote.AbstractProtocol">
<point x="0.0" y="-18.0" />
<point x="1095.0" y="147.0" />
<point x="790.75" y="147.0" />
<point x="55.25" y="18.0" />
</edge>
<edge source="org.apache.coyote.ajp.AjpNioProtocol" target="org.apache.coyote.ajp.AbstractAjpProtocol">
<point x="0.0" y="-18.0" />
<point x="0.0" y="18.0" />
</edge>
<edge source="org.apache.coyote.http11.AbstractHttp11Protocol" target="org.apache.coyote.AbstractProtocol">
<point x="0.0" y="-18.0" />
<point x="377.0" y="147.0" />
<point x="680.25" y="147.0" />
<point x="-55.25" y="18.0" />
</edge>
<edge source="org.apache.coyote.http11.Http11NioProtocol" target="org.apache.coyote.http11.AbstractHttp11Protocol">
<point x="0.0" y="-18.0" />
<point x="627.5" y="233.0" />
<point x="470.6666666666667" y="233.0" />
<point x="93.66666666666669" y="18.0" />
</edge>
<edge source="org.apache.coyote.ajp.AjpNio2Protocol" target="org.apache.coyote.ajp.AbstractAjpProtocol">
<point x="0.0" y="-18.0" />
<point x="868.5" y="233.0" />
<point x="1011.3333333333333" y="233.0" />
<point x="-83.66666666666663" y="18.0" />
</edge>
<edge source="org.apache.coyote.ajp.AjpAprProtocol" target="org.apache.coyote.ajp.AbstractAjpProtocol">
<point x="0.0" y="-18.0" />
<point x="1315.5" y="233.0" />
<point x="1178.6666666666667" y="233.0" />
<point x="83.66666666666674" y="18.0" />
</edge>
<edge source="org.apache.coyote.http11.Http11Nio2Protocol" target="org.apache.coyote.http11.AbstractHttp11Protocol">
<point x="0.0" y="-18.0" />
<point x="120.5" y="233.0" />
<point x="283.3333333333333" y="233.0" />
<point x="-93.66666666666669" y="18.0" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.1" x="777.1717171717168" y="233.63636363636363" />
<SelectedNodes>
<node>org.apache.coyote.ProtocolHandler</node>
</SelectedNodes>
<Categories />
<SCOPE>All</SCOPE>
<VISIBILITY>private</VISIBILITY>
</Diagram>

133 changes: 133 additions & 0 deletions assets/server/tomcat/Tomcat生周期管理总体类图.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>JAVA</ID>
<OriginalElement>org.apache.catalina.Lifecycle</OriginalElement>
<nodes>
<node x="663.0" y="278.0">org.apache.catalina.core.StandardEngine</node>
<node x="326.50000000000006" y="192.0">org.apache.catalina.core.ContainerBase</node>
<node x="298.75000000000006" y="86.0">org.apache.catalina.Container</node>
<node x="910.1875" y="0.0">org.apache.catalina.Lifecycle</node>
<node x="201.00000000000006" y="278.0">org.apache.catalina.core.StandardWrapper</node>
<node x="1045.25" y="192.0">org.apache.catalina.connector.Connector</node>
<node x="979.7948529411765" y="86.0">org.apache.catalina.util.LifecycleBase</node>
<node x="432.00000000000006" y="278.0">org.apache.catalina.core.StandardContext</node>
<node x="0.0" y="278.0">org.apache.catalina.core.StandardHost</node>
<node x="824.25" y="192.0">org.apache.catalina.core.StandardServer</node>
<node x="1216.25" y="192.0">org.apache.catalina.core.StandardService</node>
</nodes>
<notes />
<edges>
<edge source="org.apache.catalina.util.LifecycleBase" target="org.apache.catalina.Lifecycle">
<point x="0.0" y="-18.0" />
<point x="1075.2948529411765" y="66.0" />
<point x="1004.5625" y="66.0" />
<point x="18.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardHost" target="org.apache.catalina.core.ContainerBase">
<point x="45.25" y="-18.0" />
<point x="135.75" y="258.0" />
<point x="350.37500000000006" y="258.0" />
<point x="-71.625" y="18.0" />
</edge>
<edge source="org.apache.catalina.Container" target="org.apache.catalina.Lifecycle">
<point x="0.0" y="-18.0" />
<point x="374.25000000000006" y="56.0" />
<point x="929.0625" y="56.0" />
<point x="-56.625" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardContext" target="org.apache.catalina.core.ContainerBase">
<point x="-52.75" y="-18.0" />
<point x="484.75000000000006" y="258.0" />
<point x="445.87500000000006" y="258.0" />
<point x="23.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.connector.Connector" target="org.apache.catalina.util.LifecycleBase">
<point x="0.0" y="-18.0" />
<point x="1120.75" y="172.0" />
<point x="1099.1698529411765" y="172.0" />
<point x="23.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardServer" target="org.apache.catalina.Lifecycle">
<point x="-50.25" y="-18.0" />
<point x="874.5" y="152.0" />
<point x="852.9198529411765" y="152.0" />
<point x="852.9198529411765" y="66.0" />
<point x="966.8125" y="66.0" />
<point x="-18.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardService" target="org.apache.catalina.util.LifecycleBase">
<point x="-52.75000000000006" y="-18.0" />
<point x="1269.0" y="172.0" />
<point x="1146.9198529411765" y="172.0" />
<point x="71.625" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardEngine" target="org.apache.catalina.Container">
<point x="50.25" y="-18.0" />
<point x="813.75" y="142.0" />
<point x="434.65000000000015" y="142.0" />
<point x="60.40000000000009" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardContext" target="org.apache.catalina.Container">
<point x="52.75" y="-18.0" />
<point x="590.25" y="258.0" />
<point x="578.5625" y="258.0" />
<point x="578.5625" y="152.0" />
<point x="404.4500000000001" y="152.0" />
<point x="30.200000000000045" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardServer" target="org.apache.catalina.util.LifecycleBase">
<point x="50.25" y="-18.0" />
<point x="975.0" y="172.0" />
<point x="1051.4198529411765" y="172.0" />
<point x="-23.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardService" target="org.apache.catalina.Lifecycle">
<point x="52.75" y="-18.0" />
<point x="1374.5" y="56.0" />
<point x="1042.3125" y="56.0" />
<point x="56.625" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardWrapper" target="org.apache.catalina.core.ContainerBase">
<point x="52.75" y="-18.0" />
<point x="359.25000000000006" y="258.0" />
<point x="398.12500000000006" y="258.0" />
<point x="-23.875" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.ContainerBase" target="org.apache.catalina.util.LifecycleBase">
<point x="47.75" y="-18.0" />
<point x="469.75000000000006" y="162.0" />
<point x="1003.6698529411765" y="162.0" />
<point x="-71.625" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardHost" target="org.apache.catalina.Container">
<point x="-45.25" y="-18.0" />
<point x="45.25" y="162.0" />
<point x="313.8500000000001" y="162.0" />
<point x="-60.39999999999998" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardWrapper" target="org.apache.catalina.Container">
<point x="-52.75" y="-18.0" />
<point x="253.75000000000006" y="248.0" />
<point x="265.43750000000006" y="248.0" />
<point x="265.43750000000006" y="172.0" />
<point x="344.05" y="172.0" />
<point x="-30.200000000000045" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.ContainerBase" target="org.apache.catalina.Container">
<point x="-47.75" y="-18.0" />
<point x="0.0" y="18.0" />
</edge>
<edge source="org.apache.catalina.core.StandardEngine" target="org.apache.catalina.core.ContainerBase">
<point x="-50.25" y="-18.0" />
<point x="713.25" y="248.0" />
<point x="493.62500000000006" y="248.0" />
<point x="71.625" y="18.0" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="0.599184505606524" x="760.3586253827832" y="406.59273477381487" />
<SelectedNodes />
<Categories />
<SCOPE>All</SCOPE>
<VISIBILITY>public</VISIBILITY>
</Diagram>

Binary file added assets/server/tomcat/jetty.xmind
Binary file not shown.
Binary file added assets/server/tomcat/tomcat.eddx
Binary file not shown.
Binary file added assets/server/tomcat/tomcat.xmind
Binary file not shown.
2 changes: 1 addition & 1 deletion codes/javatech-mq/javatech-kafka-springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.dunwu</groupId>
<artifactId>dunwu-starter-parent</artifactId>
<version>0.5.7</version>
<version>0.5.6</version>
</parent>

<groupId>io.github.dunwu.javatech</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,49 +85,51 @@ private static String getAbsolutePath() {
return path;
}

}

class ExtendedTomcat extends Tomcat {
static class ExtendedTomcat extends Tomcat {

private static final String RELATIVE_SERVERXML_PATH = "/conf/server.xml";
private static final String RELATIVE_SERVERXML_PATH = "/conf/server.xml";

private Logger log = LoggerFactory.getLogger(this.getClass());
private Logger log = LoggerFactory.getLogger(this.getClass());

@Override
public Server getServer() {
if (server != null) {
return server;
}
// 默认不开启JNDI. 开启时, 注意maven必须添加tomcat-dbcp依赖
System.setProperty("catalina.useNaming", "false");
ExtendedCatalina extendedCatalina = new ExtendedCatalina();

// 覆盖默认的skip和scan jar包配置
System.setProperty(Constants.SKIP_JARS_PROPERTY, "");
System.setProperty(Constants.SCAN_JARS_PROPERTY, "");

Digester digester = extendedCatalina.createStartDigester();
digester.push(extendedCatalina);
try {
server = ((ExtendedCatalina) digester
.parse(new File(System.getProperty("catalina.base") + RELATIVE_SERVERXML_PATH))).getServer();
// 设置catalina.base和catalna.home
this.initBaseDir();
return server;
} catch (Exception e) {
log.error("Error while parsing server.xml", e);
throw new RuntimeException("server未创建,请检查server.xml(路径:" + System.getProperty("catalina.base")
+ RELATIVE_SERVERXML_PATH + ")配置是否正确");
@Override
public Server getServer() {
if (server != null) {
return server;
}
// 默认不开启JNDI. 开启时, 注意maven必须添加tomcat-dbcp依赖
System.setProperty("catalina.useNaming", "false");
ExtendedCatalina extendedCatalina = new ExtendedCatalina();

// 覆盖默认的skip和scan jar包配置
System.setProperty(Constants.SKIP_JARS_PROPERTY, "");
System.setProperty(Constants.SCAN_JARS_PROPERTY, "");

Digester digester = extendedCatalina.createStartDigester();
digester.push(extendedCatalina);
try {
server = ((ExtendedCatalina) digester
.parse(new File(System.getProperty("catalina.base") + RELATIVE_SERVERXML_PATH))).getServer();
// 设置catalina.base和catalna.home
this.initBaseDir();
return server;
} catch (Exception e) {
log.error("Error while parsing server.xml", e);
throw new RuntimeException("server未创建,请检查server.xml(路径:" + System.getProperty("catalina.base")
+ RELATIVE_SERVERXML_PATH + ")配置是否正确");
}
}
}

private static class ExtendedCatalina extends Catalina {
private static class ExtendedCatalina extends Catalina {

@Override
public Digester createStartDigester() {
return super.createStartDigester();
}

@Override
public Digester createStartDigester() {
return super.createStartDigester();
}

}

}


Loading

0 comments on commit ae82bf0

Please sign in to comment.