Java Code Examples for org.redisson.api.RedissonClient#getExecutorService()

The following examples show how to use org.redisson.api.RedissonClient#getExecutorService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExecutorServiceExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example 2
Source File: SchedulerServiceExamples.java    From redisson-examples with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example 3
Source File: MapReduceExecutor.java    From redisson with Apache License 2.0 5 votes vote down vote up
MapReduceExecutor(RObject object, RedissonClient redisson, ConnectionManager connectionManager) {
    this.objectName = object.getName();
    this.objectCodec = object.getCodec();
    this.objectClass = object.getClass();

    this.redisson = redisson;
    UUID id = UUID.randomUUID();
    this.resultMapName = object.getName() + ":result:" + id;
    this.executorService = redisson.getExecutorService(RExecutorService.MAPREDUCE_NAME);
    this.connectionManager = connectionManager;
}
 
Example 4
Source File: RedisEventPublisherImpl.java    From earth-frost with Apache License 2.0 4 votes vote down vote up
public RedisEventPublisherImpl(RedissonClient redissonClient) {
  this.executorService = redissonClient.getExecutorService(Container.EVENT);
}