public final class PartitionsUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static List<List<com.google.common.net.HostAndPort>> |
getDefaultLocalPartition(int port) |
static List<List<com.google.common.net.HostAndPort>> |
parseAllPartitions(CharSequence value) |
static List<List<com.google.common.net.HostAndPort>> |
parsePartitionsFromStatus(URL url)
Reads partition information from an XML status document from the cluster, which includes information
on partitions and their replicas.
|
public static List<List<com.google.common.net.HostAndPort>> parseAllPartitions(CharSequence value)
value - describes all partitions, when partitioning across Serving Layers
by user. Each partition may have multiple replicas. Serving Layers are specified as "host:port".
Replicas are specified as many Serving Layers, separated by commas, like "rep1:port1,rep2:port2,...".
Finally, partitions are specified as multiple replicas separated by semicolon, like
"part1rep1:port11,part1rep2:port12;part2rep1:port21,part2rep2:port22;...". Example:
"foo:80,foo2:8080;bar:8080;baz2:80,baz3:80"List of partitions, where each partition is a List of replicas, where each
replica is a host-port pair, as HostAndPortpublic static List<List<com.google.common.net.HostAndPort>> getDefaultLocalPartition(int port)
port - port the instance is configured to run onpublic static List<List<com.google.common.net.HostAndPort>> parsePartitionsFromStatus(URL url) throws IOException
url - URL holding cluster status as an XML documentList of partitions, each of which is a List of replicas in a partition,
each represented as a HostAndPortIOException - if the URL can't be accessed or its XML content parsedCopyright © 2012-2013 Myrrix Ltd. All Rights Reserved.