Skip to content

Commit 544bbab

Browse files
committed
docs: fix typo and improve wording
1 parent 278d897 commit 544bbab

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ Java Dns Cache Manipulator(`DCM`) contains 2 subprojects:
7979

8080
## 🎨 Requirement Scenario
8181

82-
1. The domain name is hard-coded in some libraries, and have to modify the `host file` binding to do the test(eg. unit test, integration test). Turn out:
82+
1. The domain name is hard-coded in some libraries, and have to modify the `host file` binding to do the test(e.g. unit test, integration test). Turn out:
8383
- Generally, developers do not have the permission to modify the `host file` on the continuous integration machine, which leads to the continuous integration of the project fail.
8484
- In fact, because of this, the demand for this library was born. 😣 🔫
8585
- Unit testing requires each developer to do some host binding on the development machine, which increases configuration operations and is tedious and repetitive.
8686
2. Some functions require domain names instead of IPs as input parameters, such as HTTP gateways or web applications with domain name restrictions.
8787
- In this case, you need a domain name to connect to the IP of the test machine; Or need use a test domain name that does not exist yet, but you do not want to or can not configure the DNS.
8888
3. In the performance test,
89-
- want to skip lookup DNS through network (bypass the DNS resolution consumption), so that stress testing pays more attention to server response, and stress testing can fully reflects the performance of the core implementation code.
89+
- want to skip lookup DNS through network (bypass the DNS resolution consumption), so that stress testing pays more attention to server response, and stress testing can fully reflect the performance of the core implementation code.
9090
- DNS cache can be set dynamically instead of inflexible ways such as modifying host files and http links.
9191
- A `JVM` process 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.
9292
4. When opening the `SecurityManager` in `Java` (such as a web application in the Web container `Tomcat`), `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.
9393
- Set the running JVM DNS Cache through the `DCM` Tool.
94-
application **need not** contain `DCM` Library dependency (ie. `Jar`).
94+
application **need not** contain `DCM` Library dependency (i.e. `Jar`).
9595
- Or call the method of `DCM` Library through the execution entry, such as remote call or [`jvm-ssh-groovy-shell`](https://github.com/palominolabs/jvm-ssh-groovy-shell).
9696
The application **need** contain `DCM` Library dependency (ie `Jar`).
9797

@@ -218,9 +218,9 @@ DnsCacheManipulator.setDnsNegativeCachePolicy(0);
218218

219219
### Precautions for use
220220

221-
#### JVM settings for Java 17
221+
#### JVM settings for Java 17+
222222

223-
If use DCM under Java 17, add below Java options:
223+
If you use DCM under Java 17+, add below Java options:
224224

225225
```java
226226
--add-opens java.base/java.net=ALL-UNNAMED
@@ -290,7 +290,7 @@ You can view the latest version at [search.maven.org](https://search.maven.org/a
290290
- Open the SecurityManager in Java, the DNS cache will not be invalidated.
291291
- Otherwise, the accessible DNS resolution will be cached for 30 seconds by default, and the inaccessible DNS resolution will be cached for 10 seconds by default.
292292
- [Regarding the jvm dns cache (domain name cache time) / 关于`jvm dns cache`(域名缓存时间)](https://nigelzeng.iteye.com/blog/1704052), the conclusion of "what strategy is used to return IP for multiple A records" is given:
293-
- During the validity period of the cache, the obtained IP is always the first of all A records in the cache, and there is no such strategy as round robin.
293+
- During the validity period of the cache, the obtained IP is always the first A records in the cache, and there is no such strategy as round-robin.
294294
- After the cache is invalidated, perform DNS resolution again. Because the order of the A records returned by the domain name resolution will change (visible in the dig google.com test), the order of the data in the cache has also changed, and the obtained IP will also change.
295295
- [Modify the content of DNS cache in JDK 1.6 through JAVA reflection / 通过`JAVA`反射修改`JDK 1.6`当中`DNS`缓存内容](https://tuicool.com/articles/auYzui), give the scene of setting DNS cache in performance test.
296296
- [The dns cache problem of java InetAddress / java InetAddress 的 dns cache 问题](http://blogjava.net/jjwwhmm/archive/2008/07/09/213685.html) indicates that `HttpClient` needs to recreate the `GetMethod`/`PostMethod` object to make the DNS setting take effect.

library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public static List<DnsCacheEntry> listDnsCache() {
207207
* use {@link #listDnsCache} instead.
208208
*/
209209
@Deprecated
210+
@SuppressWarnings("DeprecatedIsStillUsed")
210211
public static List<DnsCacheEntry> getAllDnsCache() {
211212
return listDnsCache();
212213
}
@@ -268,7 +269,7 @@ public static void clearDnsCache() {
268269
* @return cache seconds.
269270
* <ul>
270271
* <li> {@link InetAddressCachePolicy#FOREVER}({@code -1}) means never expired.(In effect, all negative value)</li>
271-
* <li> {@link InetAddressCachePolicy#NEVER}(@code 0) never cached.</li>
272+
* <li> {@link InetAddressCachePolicy#NEVER}({@code 0}) never cached.</li>
272273
* </ul>
273274
* @throws DnsCacheManipulatorException Operation fail
274275
* @see InetAddressCachePolicy#get()
@@ -293,7 +294,7 @@ public static int getDnsCachePolicy() {
293294
* @param cacheSeconds set default dns cache time. Special input case:
294295
* <ul>
295296
* <li> {@link InetAddressCachePolicy#FOREVER}({@code -1}) means never expired.(In effect, all negative value)</li>
296-
* <li> {@link InetAddressCachePolicy#NEVER}(@code 0) never cached.</li>
297+
* <li> {@link InetAddressCachePolicy#NEVER}({@code 0}) never cached.</li>
297298
* </ul>
298299
* @throws DnsCacheManipulatorException Operation fail
299300
* @see InetAddressCachePolicy
@@ -318,7 +319,7 @@ public static void setDnsCachePolicy(int cacheSeconds) {
318319
* @return negative cache seconds.
319320
* <ul>
320321
* <li> {@link InetAddressCachePolicy#FOREVER}({@code -1}) means never expired.(In effect, all negative value)</li>
321-
* <li> {@link InetAddressCachePolicy#NEVER}(@code 0) never cached.</li>
322+
* <li> {@link InetAddressCachePolicy#NEVER}({@code 0}) never cached.</li>
322323
* </ul>
323324
* @throws DnsCacheManipulatorException Operation fail
324325
* @see InetAddressCachePolicy#getNegative()
@@ -340,7 +341,7 @@ public static int getDnsNegativeCachePolicy() {
340341
* @param negativeCacheSeconds set default dns cache time. Special input case:
341342
* <ul>
342343
* <li> {@link InetAddressCachePolicy#FOREVER}({@code -1}) means never expired.(In effect, all negative value)</li>
343-
* <li> {@link InetAddressCachePolicy#NEVER}(@code 0) never cached.</li>
344+
* <li> {@link InetAddressCachePolicy#NEVER}({@code 0}) never cached.</li>
344345
* </ul>
345346
* @throws DnsCacheManipulatorException Operation fail
346347
* @see InetAddressCachePolicy

0 commit comments

Comments
 (0)