本文整理汇总了Java中org.redisson.api.RedissonClient.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java RedissonClient.shutdown方法的具体用法?Java RedissonClient.shutdown怎么用?Java RedissonClient.shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.redisson.api.RedissonClient
的用法示例。
在下文中一共展示了RedissonClient.shutdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
CountDownLatch latch = new CountDownLatch(1);
RTopic<String> topic = redisson.getTopic("topic2");
topic.addListener(new MessageListener<String>() {
@Override
public void onMessage(String channel, String msg) {
latch.countDown();
}
});
topic.publish("msg");
latch.await();
redisson.shutdown();
}
示例2: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RAtomicLong atomicLong = redisson.getAtomicLong("myLong");
atomicLong.getAndDecrement();
atomicLong.getAndIncrement();
atomicLong.addAndGet(10L);
atomicLong.compareAndSet(29, 412);
atomicLong.decrementAndGet();
atomicLong.incrementAndGet();
atomicLong.getAndAdd(302);
atomicLong.getAndDecrement();
atomicLong.getAndIncrement();
redisson.shutdown();
}
示例3: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RGeo<String> geo = redisson.getGeo("myGeo");
GeoEntry entry = new GeoEntry(13.361389, 38.115556, "Palermo");
geo.add(entry);
geo.add(15.087269, 37.502669, "Catania");
Double dist = geo.dist("Palermo", "Catania", GeoUnit.METERS);
Map<String, GeoPosition> pos = geo.pos("Palermo", "Catania");
List<String> cities = geo.radius(15, 37, 200, GeoUnit.KILOMETERS);
List<String> allNearCities = geo.radius("Palermo", 10, GeoUnit.KILOMETERS);
Map<String, Double> citiesWithDistance = geo.radiusWithDistance(15, 37, 200, GeoUnit.KILOMETERS);
Map<String, Double> allNearCitiesDistance = geo.radiusWithDistance("Palermo", 10, GeoUnit.KILOMETERS);
Map<String, GeoPosition> citiesWithPosition = geo.radiusWithPosition(15, 37, 200, GeoUnit.KILOMETERS);
Map<String, GeoPosition> allNearCitiesPosition = geo.radiusWithPosition("Palermo", 10, GeoUnit.KILOMETERS);
redisson.shutdown();
}
示例4: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RHyperLogLog<String> hyperLogLog = redisson.getHyperLogLog("hyperLogLog");
hyperLogLog.add("1");
hyperLogLog.add("2");
hyperLogLog.add("3");
hyperLogLog.addAll(Arrays.asList("10", "20", "30"));
RHyperLogLog<String> hyperLogLog1 = redisson.getHyperLogLog("hyperLogLog1");
hyperLogLog1.add("4");
hyperLogLog1.add("5");
hyperLogLog1.add("6");
RHyperLogLog<String> hyperLogLog2 = redisson.getHyperLogLog("hyperLogLog2");
hyperLogLog1.add("4");
hyperLogLog1.add("5");
hyperLogLog1.add("6");
hyperLogLog2.mergeWith(hyperLogLog1.getName());
hyperLogLog2.countWith(hyperLogLog1.getName());
redisson.shutdown();
}
示例5: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
RedissonClient redisson = Redisson.create();
RBucket<String> bucket = redisson.getBucket("test");
bucket.set("123");
boolean isUpdated = bucket.compareAndSet("123", "4934");
String prevObject = bucket.getAndSet("321");
boolean isSet = bucket.trySet("901");
long objectSize = bucket.size();
// set with expiration
bucket.set("value", 10, TimeUnit.SECONDS);
boolean isNewSet = bucket.trySet("nextValue", 10, TimeUnit.SECONDS);
redisson.shutdown();
}
示例6: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RAtomicDouble atomicDouble = redisson.getAtomicDouble("myDouble");
atomicDouble.getAndDecrement();
atomicDouble.getAndIncrement();
atomicDouble.addAndGet(10.323);
atomicDouble.compareAndSet(29.4, 412.91);
atomicDouble.decrementAndGet();
atomicDouble.incrementAndGet();
atomicDouble.getAndAdd(302.00);
atomicDouble.getAndDecrement();
atomicDouble.getAndIncrement();
redisson.shutdown();
}
示例7: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient server = Redisson.create();
RedissonClient client = Redisson.create();
try {
server.getRemoteService().register(RemoteInterface.class, new RemoteImpl());
RemoteInterface service = client.getRemoteService().get(RemoteInterface.class);
service.myMethod(21L);
} finally {
client.shutdown();
server.shutdown();
}
}
示例8: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RBinaryStream stream = redisson.getBinaryStream("myStream");
byte[] values = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
stream.trySet(values);
stream.set(values);
InputStream is = stream.getInputStream();
StringBuilder sb = new StringBuilder();
int ch;
while((ch = is.read()) != -1) {
sb.append((char)ch);
}
String str = sb.toString();
OutputStream os = stream.getOutputStream();
for (int i = 0; i < values.length; i++) {
byte c = values[i];
os.write(c);
}
redisson.shutdown();
}
示例9: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(final String[] args) {
final Config config = new Config();
config.useSingleServer()
.setAddress("redis-14926.c10.us-east-1-3.ec2.cloud.redislabs.com:14926")
.setConnectionMinimumIdleSize(1)
.setConnectionPoolSize(2);
final RedissonClient client = Redisson.create(config);
try {
final RemoteInterface service = client.getRemoteService().get(RemoteInterface.class);
final long result = service.myMethod(21L);
System.out.println("result = " + result);
} finally {
client.shutdown();
}
}
示例10: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(final String[] args) {
final Config config = new Config();
config.useSingleServer()
.setAddress("redis-14926.c10.us-east-1-3.ec2.cloud.redislabs.com:14926")
.setConnectionMinimumIdleSize(1)
.setConnectionPoolSize(2);
// connects to 127.0.0.1:6379 by default
final RedissonClient server = Redisson.create(config);
final RedissonClient client = Redisson.create(config);
try {
server.getRemoteService().register(RemoteInterface.class, new RemoteImpl());
final RemoteInterface service = client.getRemoteService().get(RemoteInterface.class);
final long result = service.myMethod(21L);
System.out.println("result = " + result);
} finally {
client.shutdown();
server.shutdown();
}
}
示例11: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RSetMultimapCache<String, Integer> multimap = redisson.getSetMultimapCache("myMultimap");
multimap.put("1", 1);
multimap.put("1", 2);
multimap.put("1", 3);
multimap.put("2", 5);
multimap.put("2", 6);
multimap.put("4", 7);
// set ttl = 10 seconds
multimap.expireKey("1", 10, TimeUnit.SECONDS);
RSet<Integer> values1 = multimap.get("1");
RSet<Integer> values2 = multimap.get("2");
boolean hasEntry = multimap.containsEntry("1", 3);
Collection<Entry<String, Integer>> entries = multimap.entries();
Collection<Integer> values = multimap.values();
boolean isRemoved = multimap.remove("1", 3);
Set<Integer> removedValues = multimap.removeAll("1");
Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
boolean isNewKey = multimap.putAll("5", newValues);
Set<Integer> oldValues = multimap.replaceValues("2", newValues);
Set<Integer> allValues = multimap.getAll("2");
long keysRemoved = multimap.fastRemove("2", "32");
redisson.shutdown();
}
示例12: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RBoundedBlockingQueue<String> queue = redisson.getBoundedBlockingQueue("myQueue");
queue.add("1");
queue.add("2");
queue.add("3");
queue.add("4");
queue.add("5");
queue.trySetCapacity(5);
Thread t = new Thread(() -> {
try {
String element = queue.take();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
t.start();
queue.put("6");
redisson.shutdown();
}
示例13: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RListMultimap<String, Integer> multimap = redisson.getListMultimap("myMultimap");
multimap.put("1", 1);
multimap.put("1", 2);
multimap.put("1", 3);
multimap.put("2", 5);
multimap.put("2", 6);
multimap.put("4", 7);
RList<Integer> values1 = multimap.get("1");
RList<Integer> values2 = multimap.get("2");
boolean hasEntry = multimap.containsEntry("1", 3);
Collection<Entry<String, Integer>> entries = multimap.entries();
Collection<Integer> values = multimap.values();
boolean isRemoved = multimap.remove("1", 3);
List<Integer> removedValues = multimap.removeAll("1");
Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
boolean isNewKey = multimap.putAll("5", newValues);
List<Integer> oldValues = multimap.replaceValues("2", newValues);
List<Integer> allValues = multimap.getAll("2");
long keysRemoved = multimap.fastRemove("2", "32");
redisson.shutdown();
}
示例14: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RQueue<String> queue = redisson.getQueue("myQueue");
queue.add("1");
queue.add("2");
queue.add("3");
queue.add("4");
queue.contains("1");
queue.peek();
queue.poll();
queue.element();
for (String string : queue) {
// iteration through bulk loaded values
}
boolean removedValue = queue.remove("1");
queue.removeAll(Arrays.asList("1", "2", "3"));
queue.containsAll(Arrays.asList("4", "1", "0"));
List<String> secondList = new ArrayList<>();
secondList.add("4");
secondList.add("5");
queue.addAll(secondList);
RQueue<String> secondQueue = redisson.getQueue("mySecondQueue");
queue.pollLastAndOfferFirstTo(secondQueue.getName());
redisson.shutdown();
}
示例15: main
import org.redisson.api.RedissonClient; //导入方法依赖的package包/类
public static void main(String[] args) {
// connects to 127.0.0.1:6379 by default
RedissonClient redisson = Redisson.create();
RSetMultimap<String, Integer> multimap = redisson.getSetMultimap("myMultimap");
multimap.put("1", 1);
multimap.put("1", 2);
multimap.put("1", 3);
multimap.put("2", 5);
multimap.put("2", 6);
multimap.put("4", 7);
RSet<Integer> values1 = multimap.get("1");
RSet<Integer> values2 = multimap.get("2");
boolean hasEntry = multimap.containsEntry("1", 3);
Set<Entry<String, Integer>> entries = multimap.entries();
Collection<Integer> values = multimap.values();
boolean isRemoved = multimap.remove("1", 3);
Set<Integer> removedValues = multimap.removeAll("1");
Collection<? extends Integer> newValues = Arrays.asList(5, 6, 7, 8, 9);
boolean isNewKey = multimap.putAll("5", newValues);
Set<Integer> oldValues = multimap.replaceValues("2", newValues);
Set<Integer> allValues = multimap.getAll("2");
redisson.shutdown();
}