当前位置: 首页>>代码示例>>Java>>正文


Java RedissonNode.create方法代码示例

本文整理汇总了Java中org.redisson.RedissonNode.create方法的典型用法代码示例。如果您正苦于以下问题:Java RedissonNode.create方法的具体用法?Java RedissonNode.create怎么用?Java RedissonNode.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.redisson.RedissonNode的用法示例。


在下文中一共展示了RedissonNode.create方法的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();
}
 
开发者ID:redisson,项目名称:redisson-examples,代码行数:20,代码来源:ExecutorServiceExamples.java

示例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();
}
 
开发者ID:redisson,项目名称:redisson-examples,代码行数:24,代码来源:SchedulerServiceExamples.java

示例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();
}
 
开发者ID:KleeGroup,项目名称:vertigo-labs,代码行数:24,代码来源:ExecutorServiceExamples.java


注:本文中的org.redisson.RedissonNode.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。