Tabnine Logo
Converters.toSetOfRedisClusterNodes
Code IndexAdd Tabnine to your IDE (free)

How to use
toSetOfRedisClusterNodes
method
in
org.springframework.data.redis.connection.convert.Converters

Best Java code snippets using org.springframework.data.redis.connection.convert.Converters.toSetOfRedisClusterNodes (Showing top 9 results out of 315)

origin: spring-projects/spring-data-redis

/**
 * Converts the result of {@code CLUSTER NODES} into {@link RedisClusterNode}s.
 *
 * @param clusterNodes
 * @return
 * @since 1.7
 */
public static Set<RedisClusterNode> toSetOfRedisClusterNodes(String clusterNodes) {
  if (StringUtils.isEmpty(clusterNodes)) {
    return Collections.emptySet();
  }
  String[] lines = clusterNodes.split(CLUSTER_NODES_LINE_SEPARATOR);
  return toSetOfRedisClusterNodes(Arrays.asList(lines));
}
origin: spring-projects/spring-data-redis

  @Override
  public ClusterTopology getTopology() {
    if (cached != null && time + 100 > System.currentTimeMillis()) {
      return cached;
    }
    Map<String, Exception> errors = new LinkedHashMap<>();
    List<Entry<String, JedisPool>> list = new ArrayList<>(cluster.getClusterNodes().entrySet());
    Collections.shuffle(list);
    for (Entry<String, JedisPool> entry : list) {
      try (Jedis jedis = entry.getValue().getResource()) {
        time = System.currentTimeMillis();
        Set<RedisClusterNode> nodes = Converters.toSetOfRedisClusterNodes(jedis.clusterNodes());
        synchronized (lock) {
          cached = new ClusterTopology(nodes);
        }
        return cached;
      } catch (Exception ex) {
        errors.put(entry.getKey(), ex);
      }
    }
    StringBuilder sb = new StringBuilder();
    for (Entry<String, Exception> entry : errors.entrySet()) {
      sb.append(String.format("\r\n\t- %s failed: %s", entry.getKey(), entry.getValue().getMessage()));
    }
    throw new ClusterStateFailureException(
        "Could not retrieve cluster information. CLUSTER NODES returned with error." + sb.toString());
  }
}
origin: spring-projects/spring-data-redis

@Override
public Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap() {
  List<NodeResult<Collection<RedisClusterNode>>> nodeResults = clusterCommandExecutor.executeCommandAsyncOnNodes(
      (LettuceClusterCommandCallback<Collection<RedisClusterNode>>) client -> Converters
          .toSetOfRedisClusterNodes(client.clusterSlaves(client.clusterMyId())),
      topologyProvider.getTopology().getActiveMasterNodes()).getResults();
  Map<RedisClusterNode, Collection<RedisClusterNode>> result = new LinkedHashMap<>();
  for (NodeResult<Collection<RedisClusterNode>> nodeResult : nodeResults) {
    result.put(nodeResult.getNode(), nodeResult.getValue());
  }
  return result;
}
origin: org.springframework.data/spring-data-redis

/**
 * Converts the result of {@code CLUSTER NODES} into {@link RedisClusterNode}s.
 *
 * @param clusterNodes
 * @return
 * @since 1.7
 */
public static Set<RedisClusterNode> toSetOfRedisClusterNodes(String clusterNodes) {
  if (StringUtils.isEmpty(clusterNodes)) {
    return Collections.emptySet();
  }
  String[] lines = clusterNodes.split(CLUSTER_NODES_LINE_SEPARATOR);
  return toSetOfRedisClusterNodes(Arrays.asList(lines));
}
origin: apache/servicemix-bundles

/**
 * Converts the result of {@code CLUSTER NODES} into {@link RedisClusterNode}s.
 *
 * @param clusterNodes
 * @return
 * @since 1.7
 */
public static Set<RedisClusterNode> toSetOfRedisClusterNodes(String clusterNodes) {
  if (StringUtils.isEmpty(clusterNodes)) {
    return Collections.emptySet();
  }
  String[] lines = clusterNodes.split(CLUSTER_NODES_LINE_SEPARATOR);
  return toSetOfRedisClusterNodes(Arrays.asList(lines));
}
origin: org.springframework.data/spring-data-redis

  @Override
  public ClusterTopology getTopology() {
    if (cached != null && time + 100 > System.currentTimeMillis()) {
      return cached;
    }
    Map<String, Exception> errors = new LinkedHashMap<>();
    List<Entry<String, JedisPool>> list = new ArrayList<>(cluster.getClusterNodes().entrySet());
    Collections.shuffle(list);
    for (Entry<String, JedisPool> entry : list) {
      try (Jedis jedis = entry.getValue().getResource()) {
        time = System.currentTimeMillis();
        Set<RedisClusterNode> nodes = Converters.toSetOfRedisClusterNodes(jedis.clusterNodes());
        synchronized (lock) {
          cached = new ClusterTopology(nodes);
        }
        return cached;
      } catch (Exception ex) {
        errors.put(entry.getKey(), ex);
      }
    }
    StringBuilder sb = new StringBuilder();
    for (Entry<String, Exception> entry : errors.entrySet()) {
      sb.append(String.format("\r\n\t- %s failed: %s", entry.getKey(), entry.getValue().getMessage()));
    }
    throw new ClusterStateFailureException(
        "Could not retrieve cluster information. CLUSTER NODES returned with error." + sb.toString());
  }
}
origin: apache/servicemix-bundles

  @Override
  public ClusterTopology getTopology() {
    if (cached != null && time + 100 > System.currentTimeMillis()) {
      return cached;
    }
    Map<String, Exception> errors = new LinkedHashMap<>();
    List<Entry<String, JedisPool>> list = new ArrayList<>(cluster.getClusterNodes().entrySet());
    Collections.shuffle(list);
    for (Entry<String, JedisPool> entry : list) {
      try (Jedis jedis = entry.getValue().getResource()) {
        time = System.currentTimeMillis();
        Set<RedisClusterNode> nodes = Converters.toSetOfRedisClusterNodes(jedis.clusterNodes());
        synchronized (lock) {
          cached = new ClusterTopology(nodes);
        }
        return cached;
      } catch (Exception ex) {
        errors.put(entry.getKey(), ex);
      }
    }
    StringBuilder sb = new StringBuilder();
    for (Entry<String, Exception> entry : errors.entrySet()) {
      sb.append(String.format("\r\n\t- %s failed: %s", entry.getKey(), entry.getValue().getMessage()));
    }
    throw new ClusterStateFailureException(
        "Could not retrieve cluster information. CLUSTER NODES returned with error." + sb.toString());
  }
}
origin: org.springframework.data/spring-data-redis

@Override
public Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap() {
  List<NodeResult<Collection<RedisClusterNode>>> nodeResults = clusterCommandExecutor.executeCommandAsyncOnNodes(
      (LettuceClusterCommandCallback<Collection<RedisClusterNode>>) client -> Converters
          .toSetOfRedisClusterNodes(client.clusterSlaves(client.clusterMyId())),
      topologyProvider.getTopology().getActiveMasterNodes()).getResults();
  Map<RedisClusterNode, Collection<RedisClusterNode>> result = new LinkedHashMap<>();
  for (NodeResult<Collection<RedisClusterNode>> nodeResult : nodeResults) {
    result.put(nodeResult.getNode(), nodeResult.getValue());
  }
  return result;
}
origin: apache/servicemix-bundles

@Override
public Map<RedisClusterNode, Collection<RedisClusterNode>> clusterGetMasterSlaveMap() {
  List<NodeResult<Collection<RedisClusterNode>>> nodeResults = clusterCommandExecutor.executeCommandAsyncOnNodes(
      (LettuceClusterCommandCallback<Collection<RedisClusterNode>>) client -> Converters
          .toSetOfRedisClusterNodes(client.clusterSlaves(client.clusterMyId())),
      topologyProvider.getTopology().getActiveMasterNodes()).getResults();
  Map<RedisClusterNode, Collection<RedisClusterNode>> result = new LinkedHashMap<>();
  for (NodeResult<Collection<RedisClusterNode>> nodeResult : nodeResults) {
    result.put(nodeResult.getNode(), nodeResult.getValue());
  }
  return result;
}
org.springframework.data.redis.connection.convertConverterstoSetOfRedisClusterNodes

Javadoc

Converts the result of CLUSTER NODES into RedisClusterNodes.

Popular methods of Converters

  • toProperties
  • deserializingGeoResultsConverter
    Converter capable of deserializing GeoResults.
  • listToPropertiesConverter
    Returns a converter to convert array outputs with key-value sequences (such as produced by CONFIG GE
  • mapToPropertiesConverter
    Returns a converter to convert from Map to Properties.
  • millisecondsToTimeUnit
    Creates a new Converter to convert from milliseconds to the given TimeUnit.
  • secondsToDuration
    Convert the given nullable seconds to a Duration or null.
  • secondsToTimeUnit
    Creates a new Converter to convert from seconds to the given TimeUnit.
  • stringToBoolean
  • stringToBooleanConverter
  • toClusterNode
    Converts the result of a single line of CLUSTER NODES into a RedisClusterNode.
  • toTimeMillis
    Returns the timestamp constructed from the given seconds and microseconds.
  • toTimeMillis

Popular in Java

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • onRequestPermissionsResult (Fragment)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now