org.redisson.Redisson.getConnectionManager()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(460)

本文整理了Java中org.redisson.Redisson.getConnectionManager方法的一些代码示例,展示了Redisson.getConnectionManager的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Redisson.getConnectionManager方法的具体详情如下:
包路径:org.redisson.Redisson
类名称:Redisson
方法名:getConnectionManager

Redisson.getConnectionManager介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

protected void scheduleRetryTimeRenewal(final String requestId) {
  ((Redisson)redisson).getConnectionManager().newTimeout(new TimerTask() {
    @Override
    public void run(Timeout timeout) throws Exception {
      renewRetryTime(requestId);
    }
  }, 5, TimeUnit.SECONDS);
}

代码示例来源:origin: redisson/redisson

protected void scheduleRetryTimeRenewal(final String requestId) {
  ((Redisson)redisson).getConnectionManager().newTimeout(new TimerTask() {
    @Override
    public void run(Timeout timeout) throws Exception {
      renewRetryTime(requestId);
    }
  }, 5, TimeUnit.SECONDS);
}

代码示例来源:origin: redisson/redisson

@Override
public void pSubscribe(MessageListener listener, byte[]... patterns) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.pSubscribe(patterns);
}

代码示例来源:origin: redisson/redisson

@Override
public void pSubscribe(MessageListener listener, byte[]... patterns) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.pSubscribe(patterns);
}

代码示例来源:origin: redisson/redisson

@Override
public void pSubscribe(MessageListener listener, byte[]... patterns) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.pSubscribe(patterns);
}

代码示例来源:origin: redisson/redisson

@Override
public void subscribe(MessageListener listener, byte[]... channels) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.subscribe(channels);
}

代码示例来源:origin: redisson/redisson

@Override
public void subscribe(MessageListener listener, byte[]... channels) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.subscribe(channels);
}

代码示例来源:origin: redisson/redisson

@Override
public void subscribe(MessageListener listener, byte[]... channels) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.subscribe(channels);
}

代码示例来源:origin: redisson/redisson

@Override
public void pSubscribe(MessageListener listener, byte[]... patterns) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.pSubscribe(patterns);
}

代码示例来源:origin: redisson/redisson

@Override
public void subscribe(MessageListener listener, byte[]... channels) {
  checkSubscription();
  
  subscription = new RedissonSubscription(redisson.getConnectionManager(), redisson.getConnectionManager().getSubscribeService(), listener);
  subscription.subscribe(channels);
}

代码示例来源:origin: redisson/redisson

@Override
public void openPipeline() {
  BatchOptions options = BatchOptions.defaults()
      .executionMode(ExecutionMode.IN_MEMORY);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void openPipeline() {
  BatchOptions options = BatchOptions.defaults()
      .executionMode(ExecutionMode.IN_MEMORY);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void openPipeline() {
  BatchOptions options = BatchOptions.defaults()
      .executionMode(ExecutionMode.IN_MEMORY);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void openPipeline() {
  BatchOptions options = BatchOptions.defaults()
      .executionMode(ExecutionMode.IN_MEMORY);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

private Object executeCollator() throws ExecutionException, Exception {
  if (collator == null) {
    if (timeout > 0) {
      redisson.getMap(resultMapName).clearExpire();
    }
    return null;
  }
  
  Callable<Object> collatorTask = new CollatorTask<KOut, VOut, Object>(redisson, collator, resultMapName, objectCodecClass);
  long timeSpent = System.currentTimeMillis() - startTime;
  if (isTimeoutExpired(timeSpent)) {
    throw new MapReduceTimeoutException();
  }
  if (timeout > 0) {
    ExecutorService executor = ((Redisson) redisson).getConnectionManager().getExecutor();
    java.util.concurrent.Future<?> collatorFuture = executor.submit(collatorTask);
    try {
      return collatorFuture.get(timeout - timeSpent, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
      return null;
    } catch (TimeoutException e) {
      collatorFuture.cancel(true);
      throw new MapReduceTimeoutException();
    }
  } else {
    return collatorTask.call();
  }
}

代码示例来源:origin: redisson/redisson

@Override
public void multi() {
  if (isQueueing()) {
    return;
  }
  if (isPipelined()) {
    BatchOptions options = BatchOptions.defaults()
        .executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
    this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
    return;
  }
  
  BatchOptions options = BatchOptions.defaults()
    .executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void multi() {
  if (isQueueing()) {
    return;
  }
  if (isPipelined()) {
    BatchOptions options = BatchOptions.defaults()
        .executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
    this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
    return;
  }
  
  BatchOptions options = BatchOptions.defaults()
    .executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void multi() {
  if (isQueueing()) {
    return;
  }
  if (isPipelined()) {
    BatchOptions options = BatchOptions.defaults()
        .executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
    this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
    return;
  }
  
  BatchOptions options = BatchOptions.defaults()
    .executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public void multi() {
  if (isQueueing()) {
    return;
  }
  if (isPipelined()) {
    BatchOptions options = BatchOptions.defaults()
        .executionMode(ExecutionMode.IN_MEMORY_ATOMIC);
    this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
    return;
  }
  
  BatchOptions options = BatchOptions.defaults()
    .executionMode(ExecutionMode.REDIS_WRITE_ATOMIC);
  this.executorService = new CommandBatchService(redisson.getConnectionManager(), options);
}

代码示例来源:origin: redisson/redisson

@Override
public RedisSentinelConnection getSentinelConnection() {
  if (!redisson.getConfig().isSentinelConfig()) {
    throw new InvalidDataAccessResourceUsageException("Redisson is not in Sentinel mode");
  }
  
  SentinelConnectionManager manager = ((SentinelConnectionManager)((Redisson)redisson).getConnectionManager());
  for (RedisClient client : manager.getSentinels()) {
    org.redisson.client.RedisConnection connection = client.connect();
    try {
      String res = connection.sync(RedisCommands.PING);
      if ("pong".equalsIgnoreCase(res)) {
        return new RedissonSentinelConnection(connection);
      }
    } catch (Exception e) {
      log.warn("Can't connect to " + client, e);
      connection.closeAsync();
    }
  }
  
  throw new InvalidDataAccessResourceUsageException("Sentinels are not found");
}

相关文章