Skip to content

Commit 4147125

Browse files
committed
feat: 增加热点代码
1 parent 45ef97b commit 4147125

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • tool-java-hotcode/src/main/java/com/wdbyte/hotcode

tool-java-hotcode/src/main/java/com/wdbyte/hotcode/HotCode.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.wdbyte.hotcode;
22

3+
import java.math.BigDecimal;
34
import java.util.ArrayList;
45
import java.util.HashSet;
56
import java.util.List;
@@ -58,15 +59,13 @@ private static void allocate() {
5859
Thread.currentThread().setName("memory_allocate_thread_1");
5960
int index = 1;
6061
while (true) {
61-
array = new int[1 * index * 1000];
62-
array = new Integer[1 * index * 1000];
62+
array = new BigDecimal[1 * index * 1000];
6363
try {
6464
Thread.sleep(1000);
6565
} catch (InterruptedException e) {
6666
throw new RuntimeException(e);
6767
}
6868
index++;
69-
7069
}
7170
}).start();
7271

@@ -140,7 +139,7 @@ public static void addHashSetThread() {
140139
while (true) {
141140
try {
142141
hashSet.add("count" + count);
143-
Thread.sleep(10);
142+
Thread.sleep(5);
144143
count++;
145144
} catch (InterruptedException e) {
146145
e.printStackTrace();

0 commit comments

Comments
 (0)