本文整理汇总了Java中org.redisson.RedissonNode类的典型用法代码示例。如果您正苦于以下问题:Java RedissonNode类的具体用法?Java RedissonNode怎么用?Java RedissonNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedissonNode类属于org.redisson包,在下文中一共展示了RedissonNode类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.redisson.RedissonNode; //导入依赖的package包/类
public static void main(String[] args) {
Config config = new Config();
config.useClusterServers()
.addNodeAddress("127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003");
RedissonClient redisson = Redisson.create(config);
RedissonNodeConfig nodeConfig = new RedissonNodeConfig(config);
nodeConfig.setExecutorServiceWorkers(Collections.singletonMap("myExecutor", 1));
RedissonNode node = RedissonNode.create(nodeConfig);
node.start();
RExecutorService e = redisson.getExecutorService("myExecutor");
e.execute(new RunnableTask());
e.submit(new CallableTask());
e.shutdown();
node.shutdown();
}
示例2: main
import org.redisson.RedissonNode; //导入依赖的package包/类
public static void main(String[] args) {
Config config = new Config();
config.useClusterServers()
.addNodeAddress("127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003");
RedissonClient redisson = Redisson.create(config);
RedissonNodeConfig nodeConfig = new RedissonNodeConfig(config);
nodeConfig.setExecutorServiceWorkers(Collections.singletonMap("myExecutor", 5));
RedissonNode node = RedissonNode.create(nodeConfig);
node.start();
RScheduledExecutorService e = redisson.getExecutorService("myExecutor");
e.schedule(new RunnableTask(), 10, TimeUnit.SECONDS);
e.schedule(new CallableTask(), 4, TimeUnit.MINUTES);
e.schedule(new RunnableTask(), CronSchedule.of("10 0/5 * * * ?"));
e.schedule(new RunnableTask(), CronSchedule.dailyAtHourAndMinute(10, 5));
e.schedule(new RunnableTask(), CronSchedule.weeklyOnDayAndHourAndMinute(12, 4, Calendar.MONDAY, Calendar.FRIDAY));
e.shutdown();
node.shutdown();
}
示例3: main
import org.redisson.RedissonNode; //导入依赖的package包/类
public static void main(final String[] args) throws InterruptedException, ExecutionException {
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 RedissonNodeConfig nodeConfig = new RedissonNodeConfig(config);
nodeConfig.setExecutorServiceWorkers(Collections.singletonMap("myExecutor", 1));
final RedissonNode node = RedissonNode.create(nodeConfig);
node.start();
final RedissonClient client = Redisson.create(config);
final RExecutorService e = client.getExecutorService("myExecutor");
System.out.println("executorService.isShutdown :" + e.isShutdown());
System.out.println("executorService.isTerminated :" + e.isTerminated());
//e.execute(new RunnableTask());
final Future<String> result = e.submit(new CallableTask());
System.out.println("result =" + result.get());
e.shutdown();
node.shutdown();
}