java

序号 内容 链接地址
1 Java基础知识面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104390612

2 Java集合容器面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104588551

3 Java异常面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104390689

4 并发编程面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104863992

5 JVM面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104390752

6 Spring面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397516

7 Spring MVC面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397427

8 Spring Boot面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397299

9 Spring Cloud面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397367

10 MyBatis面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/101292950

11 Redis面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/103522351

12 MySQL数据库面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104778621

13 消息中间件MQ与RabbitMQ面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104588612

14 Dubbo面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104390006

15 Linux面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104588679

16 Tomcat面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397665

17 ZooKeeper面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104397719

18 Netty面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/104391081

19 架构设计&分布式&数据结构与算法面试题(2020最新版) https://thinkwon.blog.csdn.net/article/details/105870730

Object Storage

ibm-cos-sdk-java

1
2
3
4
5
<dependency>
<groupId>com.ibm.cos</groupId>
<artifactId>ibm-cos-java-sdk</artifactId>
<version>2.11.1</version>
</dependency>
阅读更多

apache.http.impl.client.HttpClients

1
2
3
4
5
6
7
8
try (CloseableHttpClient httpClient = HttpClients.custom().disableAutomaticRetries().build()) {
HttpPost httpPost = new HttpPost("http://www.baidu.com");

try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
int statusCode = response.getStatusLine().getStatusCode();
}
}

阅读更多

Jdk8 DNS解析

Java提供InetAddress类,可以对域名-IP进行正向、逆向解析。

InetAddress解析的时候一般是调用系统自带的DNS程序。

linux 默认的DNS方式是读取/etc/resolv.conf进行DNS解析。

mac 默认的方式是向网关请求获取DNS服务器,然后直接请求DNS服务器进行解析,没有读取/etc/resolv.conf。

DNSNameService 根据sun.net.spi.nameservice.nameservers指定的name server或/etc/resolv.conf文件中配置的name server进行DNS解析

阅读更多

ThreadPoolTaskExecutor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.util.concurrent.ThreadPoolExecutor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

@Configuration
@EnableAsync
public class ThreadPool {
public static final int DEFAULT_THREADS_NUMS = 2 * Runtime.getRuntime().availableProcessors();
@Bean("taskExecutor")
public ThreadPoolTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();

int maxPoolSize = 2 * DEFAULT_THREADS_NUMS;
threadPoolTaskExecutor.setCorePoolSize(DEFAULT_THREADS_NUMS);
threadPoolTaskExecutor.setMaxPoolSize(maxPoolSize);
threadPoolTaskExecutor.setQueueCapacity(maxPoolSize);
threadPoolTaskExecutor.setKeepAliveSeconds(60);
threadPoolTaskExecutor.setThreadNamePrefix("Async-Thread-");
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());

return threadPoolTaskExecutor;
}
}

参考文章

CompletableFuture基本用法

对比

  • Future:我们的目的都是获取异步任务的结果,但是对于Future来说,只能通过get方法或者死循环判断isDone来获取。异常情况就更是难办。
  • CompletableFuture:只要我们设置好回调函数即可实现:
  1. 只要任务完成,即执行我们设置的函数(不用再去考虑什么时候任务完成)
  2. 如果发生异常,同样会执行我们处理异常的函数,甚至连默认返回值都有(异常情况处理更加省力)
  3. 如果有复杂任务,比如依赖问题,组合问题等,同样可以写好处理函数来处理(能应付复杂任务的处理)
阅读更多

ConfigurationProperties

在 Spring Boot 项目中,我们将大量的参数配置在 application.properties 或 application.yml 文件中,通过 @ConfigurationProperties 注解,我们可以方便的获取这些参数值

阅读更多