當前位置: 首頁>>代碼示例>>Java>>正文


Java RedissonNode類代碼示例

本文整理匯總了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();
}
 
開發者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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。