Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JetCacheExecutor.java and Update AbstractExternalCacheTest.java #811

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicInteger;

/**
* Created on 2017/5/3.
Expand All @@ -14,7 +15,7 @@ public class JetCacheExecutor {
protected volatile static ScheduledExecutorService defaultExecutor;
protected volatile static ScheduledExecutorService heavyIOExecutor;

private static int threadCount;
private static AtomicInteger threadCount = new AtomicInteger(0);

static {
Runtime.getRuntime().addShutdownHook(new Thread() {
Expand Down Expand Up @@ -55,7 +56,7 @@ public static ScheduledExecutorService heavyIOExecutor() {
synchronized (JetCacheExecutor.class) {
if (heavyIOExecutor == null) {
ThreadFactory tf = r -> {
Thread t = new Thread(r, "JetCacheHeavyIOExecutor" + threadCount++);
Thread t = new Thread(r, "JetCacheHeavyIOExecutor" + threadCount.getAndIncrement());
t.setDaemon(true);
return t;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected void nullKeyConvertorTest() {
d2.setName("HL2");

cache.put(d1, "V2");
Assert.assertNull("V2", cache.get(d2));
Assert.assertEquals("V2", cache.get(d2));
xiezheng-XD marked this conversation as resolved.
Show resolved Hide resolved
Assert.assertNull(cache.get(d3));
}
}
Expand Down