mport com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.redisson.Redisson;
import org.redisson.api.*;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class RedissonTest {
@Test
public void testAtomic() {
RedissonClient client = createClient();
RAtomicLong rAtomicLong = client.getAtomicLong("RAtomicLong");
Callable callable = () -> {
String threadName = Thread.currentThread().getName();
// test
long count = rAtomicLong.addAndGet(1);
System.out.printf("thread:{%s} >>> %d
", threadName, count);
return count;
};
try {
ThreadPool.invoke(callable, 100);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
ThreadPool.shutdown();
}
// selfLock();
}
@Test
public void testSet() {
RedissonClient client = createClient();
RSet