Skip to content

Commit 29a6cc9

Browse files
committed
Java_函数式编程
1 parent 6a30664 commit 29a6cc9

19 files changed

Lines changed: 1654 additions & 8 deletions

SREADME.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Full-Stack-Notes
2+
3+
<div align="center"> <img width="380px" src="pictures/full-stack-notes-logo.png"/> </div>
4+
<br/>
5+
6+
<div align="center">
7+
<img src="pictures/芽.png"/>
8+
<strong>一个处于萌芽阶段的知识库,用于持续分享自己的所见、所学、所思!</strong>
9+
</div>
10+
<br/>
11+
12+
<div align="right">
13+
<a href="">点击切换详细目录</a>
14+
</div>
15+
16+
## :coffee: JAVA
17+
18+
1. [Java 反射与注解](notes/Java_反射与注解.md)
19+
2. [Java 并发编程](notes/Java_并发编程.md)
20+
3. [Java 设计模式](notes/Java_设计模式.md)
21+
4. [Java 虚拟机](notes/Java_虚拟机.md)
22+
5. [JVM 性能监控之命令行工具](notes/JVM_性能监控之命令行工具.md)
23+
6. [JVM 性能监控之可视化工具](notes/JVM_性能监控之可视化工具.md)
24+
7. [Java NIO 核心组件详解](notes/Java_NIO.md)
25+
8. 函数式编程
26+
9. [Tomcat 架构解析](notes/Tomcat_架构解析.md)
27+
10. Java 集合类源码解析
28+
29+
<br/>
30+
31+
## :globe_with_meridians: 计算机与网络基础
32+
33+
1. [计算机网络模型](notes/计算机网络.md)
34+
35+
2. HTTP 协议详解
36+
37+
3. HTTPS 协议详解
38+
39+
4. 抓包神器 Wireshark
40+
41+
5. 计算机组成原理
42+
43+
<br/>
44+
45+
## :computer: 前端基础
46+
47+
1. [JavaScript 基础](notes/JavaScript_基础.md)
48+
49+
2. [ECMAScript 6.0 基础](notes/ES6_基础.md)
50+
51+
3. CSS 基础
52+
53+
4. JavaScript 设计模式
54+
55+
<br/>
56+
57+
## :dolphin: 数据库
58+
59+
### MySQL
60+
61+
1. [MySQL 核心概念](notes/MySQL_基础.md)
62+
63+
2. [MySQL 备份详解](notes/MySQL_备份.md)
64+
65+
3. [MySQL 复制详解](notes/MySQL_复制.md)
66+
67+
4. [MySQL 高可用架构之 PXC 集群](notes/MySQL_PXC集群.md)
68+
69+
5. [MyCat 读写分离与分库分表](notes/MySQL_Mycat中间件.md)
70+
71+
6. [MySQL 查询性能分析之 Explain](notes/MySQL_EXPLAIN.md)
72+
73+
### Redis
74+
75+
1. [Redis 基本数据类型和常用命令](notes/Redis_数据类型和常用命令.md)
76+
77+
2. [Redis AOF 和 RDB 持久化策略原理](notes/Redis_持久化.md)
78+
79+
3. [Redis 哨兵模式](notes/Redis_哨兵模式.md)
80+
81+
4. [Redis 集群模式](notes/Redis_集群模式.md)
82+
83+
5. 使用 Redis 实现分布式锁
84+
85+
86+
### MongoDB
87+
88+
1. [MongoDB 基础](notes/MongoDB_基础.md)
89+
90+
2. [MongoDB 索引](notes/MongoDB_索引.md)
91+
92+
3. [MongoDB 聚合](notes/MongoDB_聚合.md)
93+
94+
4. [MongoDB 复制](notes/MongoDB_复制.md)
95+
96+
5. [MongoDB 分片](notes/MongoDB_分片.md)
97+
98+
<br/>
99+
100+
## :whale: 系统与容器
101+
102+
1. [Linux 常用 Shell 命令](notes/Linux_常用Shell命令.md)
103+
104+
2. [Sehll 脚本编程基础](notes/Shell_基础.md)
105+
106+
3. [Docker 基础](notes/Docker_基础.md)
107+
108+
<br/>
109+
110+
## :package: 常用技术栈
111+
112+
113+
### RabbitMQ
114+
115+
1. [RabbitMQ 核心概念](notes/RabbitMQ_基础.md)
116+
117+
2. [RabbitMQ 客户端开发](notes/RabbitMQ_客户端开发.md)
118+
119+
3. [HAProxy + KeepAlived 搭建 RabbitMQ 高可用集群](notes/RabbitMQ_高可用集群架构.md)
120+
121+
### Nginx
122+
123+
1. [Nginx 基础之静态网站部署,负载均衡,动静分离](notes/Nginx_基础.md)
124+
2. HTTP 模块详解
125+
3. Nginx 性能优化
126+
127+
128+
### Kafka
129+
130+
1. [Kafka 简介](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Kafka简介.md)
131+
2. [基于 Zookeeper 搭建 Kafka 高可用集群](https://github.com/heibaiying/BigData-Notes/blob/master/notes/installation/基于Zookeeper搭建Kafka高可用集群.md)
132+
3. [Kafka 生产者详解](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Kafka生产者详解.md)
133+
4. [Kafka 消费者详解](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Kafka消费者详解.md)
134+
5. [深入理解 Kafka 副本机制](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Kafka深入理解分区副本机制.md)
135+
136+
137+
### ZooKeeper
138+
139+
1. [ZooKeeper 简介及核心概念](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Zookeeper简介及核心概念.md)
140+
2. [ZooKeeper 单机环境和集群环境搭建](https://github.com/heibaiying/BigData-Notes/blob/master/notes/installation/Zookeeper单机环境和集群环境搭建.md)
141+
3. [ZooKeeper 常用 Shell 命令](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Zookeeper常用Shell命令.md)
142+
4. [ZooKeeper Java 客户端](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Zookeeper_Java客户端Curator.md)
143+
5. [ZooKeeper ACL 权限控制](https://github.com/heibaiying/BigData-Notes/blob/master/notes/Zookeeper_ACL权限控制.md)
144+
6. 使用 ZooKeeper 实现分布式锁
145+
146+
## ElasticSearch
147+
148+
TODO
149+
150+
<br/>
151+
152+
## :rocket: 测试与运维
153+
154+
1. 性能测试之 Jmeter
155+
2. 性能测试之 LoadRunner
156+
3. Jenkins 持续交付与自动化部署
157+
158+
<br/>
159+
160+
## :bullettrain_side: 微服务与分布式
161+
162+
1. 分布式锁的实现
163+
2. 分布式选举算法
164+
3. 分布式事务实现原理
165+
4. 分布式全局 ID 的生成
166+
5. CAP 理论和 BASE 理论
167+
168+
<br/>
169+
170+
## :hammer_and_wrench: 常用软件安装
171+
172+
1. [Redis 单机环境安装](notes/installation/Redis单机环境搭建.md)
173+
2. [RabbitMQ 单机环境安装](notes/installation/RabbitMQ单机环境搭建.md)
174+
3. [Nginx 单机环境安装](notes/installation/Nginx编译方式安装.md)
175+
4. [MySQL 单机环境安装](notes/installation/MySQL单机环境搭建.md)
176+
5. [MongoDB 单机环境安装](notes/installation/MongoDB单机环境搭建.md)
177+
6. [ElasticSearch + Kibana 单机环境安装](notes/installation/ElasticSearch+Kibana单机环境搭建.md)
178+
179+
<br>
180+
181+
<div align="center"> <img width="200px" src="pictures/blog-logo.png"/> </div>
182+
183+
<div align="center"> <a href = "https://blog.csdn.net/m0_37809146"> 欢迎关注我的博客:https://blog.csdn.net/m0_37809146</a> </div>

code/Java/stream-tutorial/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>stream-tutorial</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<build>
11+
<plugins>
12+
<plugin>
13+
<groupId>org.apache.maven.plugins</groupId>
14+
<artifactId>maven-compiler-plugin</artifactId>
15+
<configuration>
16+
<source>8</source>
17+
<target>8</target>
18+
</configuration>
19+
</plugin>
20+
</plugins>
21+
</build>
22+
23+
24+
<dependencies>
25+
<!-- https://mvnrepository.com/artifact/org.redisson/redisson -->
26+
<dependency>
27+
<groupId>org.redisson</groupId>
28+
<artifactId>redisson</artifactId>
29+
<version>3.12.5</version>
30+
</dependency>
31+
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
32+
<dependency>
33+
<groupId>redis.clients</groupId>
34+
<artifactId>jedis</artifactId>
35+
<version>3.2.0</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.apache.curator</groupId>
39+
<artifactId>curator-framework</artifactId>
40+
<version>4.3.0</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.apache.curator</groupId>
44+
<artifactId>curator-recipes</artifactId>
45+
<version>4.3.0</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.apache.zookeeper</groupId>
49+
<artifactId>zookeeper</artifactId>
50+
<version>3.4.14</version>
51+
</dependency>
52+
</dependencies>
53+
54+
</project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.heibaiying;
2+
3+
import org.apache.curator.RetryPolicy;
4+
import org.apache.curator.framework.CuratorFramework;
5+
import org.apache.curator.framework.CuratorFrameworkFactory;
6+
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
7+
import org.apache.curator.retry.RetryNTimes;
8+
9+
import java.util.concurrent.TimeUnit;
10+
11+
public class DistributedLock {
12+
13+
14+
public static void main(String[] args) throws Exception {
15+
16+
17+
RetryPolicy retryPolicy = new RetryNTimes(3, 5000);
18+
CuratorFramework client = CuratorFrameworkFactory.builder()
19+
.connectString("192.168.0.105:2181")
20+
.sessionTimeoutMs(10000).retryPolicy(retryPolicy)
21+
.namespace("mySpace").build();
22+
client.start();
23+
24+
// 1. 创建分布式锁
25+
InterProcessMutex lock = new InterProcessMutex(client, "/distributed/myLock");
26+
27+
// 2.尝试获取分布式锁
28+
if (lock.acquire(10, TimeUnit.SECONDS)) {
29+
try {
30+
System.out.println("模拟业务耗时");
31+
Thread.sleep(3 * 1000);
32+
} finally {
33+
// 3.释放锁
34+
lock.release();
35+
}
36+
}
37+
38+
client.close();
39+
}
40+
41+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package com.heibaiying;
2+
3+
public class Employee {
4+
private String name;
5+
private String gender;
6+
private String company;
7+
private int age;
8+
private boolean isOfficial;
9+
10+
public Employee(String name, String gender, String company, int age) {
11+
this.name = name;
12+
this.gender = gender;
13+
this.company = company;
14+
this.age = age;
15+
}
16+
17+
Employee(String name, int age,boolean isOfficial) {
18+
this.name = name;
19+
this.age = age;
20+
this.isOfficial = isOfficial;
21+
}
22+
23+
@Override
24+
public String toString() {
25+
return "Employee{" +
26+
"name='" + name + '\'' +
27+
'}';
28+
}
29+
30+
public boolean isOfficial() {
31+
return isOfficial;
32+
}
33+
34+
public void setOfficial(boolean official) {
35+
isOfficial = official;
36+
}
37+
38+
public String getName() {
39+
return name;
40+
}
41+
42+
public void setName(String name) {
43+
this.name = name;
44+
}
45+
46+
public String getGender() {
47+
return gender;
48+
}
49+
50+
public void setGender(String gender) {
51+
this.gender = gender;
52+
}
53+
54+
public String getCompany() {
55+
return company;
56+
}
57+
58+
public void setCompany(String company) {
59+
this.company = company;
60+
}
61+
62+
public int getAge() {
63+
return age;
64+
}
65+
66+
public void setAge(int age) {
67+
this.age = age;
68+
}
69+
70+
}

0 commit comments

Comments
 (0)