chore(deps-dev): bump io.github.git-commit-id:git-commit-id-maven-plugin (#398)
Bumps io.github.git-commit-id:git-commit-id-maven-plugin from 9.1.0 to 10.0.0.
updated-dependencies:
- dependency-name: io.github.git-commit-id:git-commit-id-maven-plugin dependency-version: 10.0.0 dependency-type: direct:development update-type: version-update:semver-major …
Signed-off-by: dependabot[bot] support@github.com Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
📖 English Documentation | 📖 中文文档
Java Dns Cache Manipulator(
DCM) contains 2 subprojects:DCMLibraryA tiny 0-dependency thread-safe lib for setting/viewing dns programmatically without touching host file, make unit/integration test portable. Support
Java 8~21, supportIPv6.DCMToolA tiny tool for setting/viewing dns of running JVM processes.
DCM) Librarydns-cache.propertiesfileJVMJava Dns Cache Manipulator(
DCM) Library🔧 Features
DNS recordPropertiesfileJVM(positive dns cache and negative dns cache)🎨 Requirement Scenario
host filebinding to do the test(e.g. unit test, integration test). Turn out:host fileon the continuous integration machine, which leads to the continuous integration fail.JVMprocess can have a set of domain name binding without affecting other JVM, be able to run stress testing with multi-scenario and multi-domain binding.SecurityManagerinJava(such as a web application in the Web containerTomcat),Java‘s DNS will not be expired by default. If the IP bound to the domain name changes, you can reset the DNS through this library.DCMTool. application need not containDCMLibrary dependency (i.e.Jar).DCMLibrary through the execution entry, such as remote call orjvm-ssh-groovy-shell. The application need containDCMLibrary dependency (ieJar).👥 User Guide
Set/View DNS through the class
DnsCacheManipulator.Set directly
Batch configuration through the
dns-cache.propertiesfileIn testing, it is expected that the domain name binding will be written in a configuration file.
The usage is as follows:
provide the file
dns-cache.propertieson ClassPath:Then complete the batch setting with the following code:
In unit testing, it is often written in the
setUpmethod of the test class, such as:View JVM DNS cache
Remove a DNS cache
aka. relookup DNS later.
Clear JVM DNS cache
Set/View the default DNS cache time of JVM
Precautions for use
JVM settings for Java 16+
With the release of Java 16 the access control of the new Jigsaw module system is starting to be enforced by the JVM. If you use
DCMunder Java 16+, add below Java options:If you use
maven(e.g. running test), add below config:Domain name case
The domain name is not case-sensitive.
The domain name may be converted to lower case uniformly before entering the
JVMDNS Cache.One of the causes is that the case of the domain name in the DNS query result will be different from the case of the entered domain name, if the entered domain name has uppercase letters.
Domain resolution cache
For
HttpClient:More detailed functions
See the documentation for the class
DnsCacheManipulator.🔌 Java API Docs
Java API document: http://alibaba.github.io/java-dns-cache-manipulator/apidocs
🍪 Dependency
Mavenexample:You can view the latest version at search.maven.org.
🗿 More Documentation
📚 Related Resources
java dns解析缓存之源码解析 is very complete and have source code analysis, give noteworthy conclusions:jvm dns cache(域名缓存时间), the conclusion of “what strategy is used to return IP for multiple A records” is given:JAVA反射修改JDK 1.6当中DNS缓存内容, give the scene of setting DNS cache in performance test.HttpClientneeds to recreate theGetMethod/PostMethodobject to make the DNS setting take effect.Java Dns Cache Manipulator Tool
🔧 Features
JVM👥 User Guide
Download
dcm-x.y.z.tar.gz.After decompression, run
dcmin thebindirectory.Set/reset a DNS cache entry
View DNS cache entry content
View single entry:
View all DNS cache:
Remove a DNS Cache
Clear DNS Cache
Set/View DNS cache time of
JVMLoad Cache Entries from File
Manipulate cache with a command line option at JVM startup
To manipulate dns entries at jvm startup, add the following jvm-options:
📚 Related information