Class AddrUtil


  • public class AddrUtil
    extends java.lang.Object
    Convenience utilities for simplifying common address parsing.
    • Constructor Summary

      Constructors 
      Constructor Description
      AddrUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.net.InetSocketAddress> getAddresses​(java.lang.String s)
      Split a string in the form of "host:port host2:port" into a List of InetSocketAddress instances suitable for instantiating a MemcachedClient.
      static java.util.Map<java.net.InetSocketAddress,​java.net.InetSocketAddress> getAddressMap​(java.lang.String s)
      Split a string in the form of "host1:port1,host2:port2 host3:port3,host4:port4" into a Map of InetSocketAddress instances suitable for instantiating a MemcachedClient,map's key is the main memcached node,and value is the standby node for main node.
      private static java.net.InetSocketAddress getInetSocketAddress​(java.lang.String s, java.lang.String mainHost)  
      static java.net.InetSocketAddress getOneAddress​(java.lang.String server)  
      static java.lang.String getServerString​(java.net.InetSocketAddress addr)
      Create an unresolved server string (hostname:port) from an InetSocketAddress.
      static boolean isEnableShutDownHook()
      System property to control shutdown hook, issue #44
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AddrUtil

        public AddrUtil()
    • Method Detail

      • getAddressMap

        public static java.util.Map<java.net.InetSocketAddress,​java.net.InetSocketAddress> getAddressMap​(java.lang.String s)
        Split a string in the form of "host1:port1,host2:port2 host3:port3,host4:port4" into a Map of InetSocketAddress instances suitable for instantiating a MemcachedClient,map's key is the main memcached node,and value is the standby node for main node. Note that colon-delimited IPv6 is also supported. For example: ::1:11211
        Parameters:
        s -
        Returns:
      • getInetSocketAddress

        private static java.net.InetSocketAddress getInetSocketAddress​(java.lang.String s,
                                                                       java.lang.String mainHost)
      • getAddresses

        public static java.util.List<java.net.InetSocketAddress> getAddresses​(java.lang.String s)
        Split a string in the form of "host:port host2:port" into a List of InetSocketAddress instances suitable for instantiating a MemcachedClient. Note that colon-delimited IPv6 is also supported. For example: ::1:11211
      • getOneAddress

        public static java.net.InetSocketAddress getOneAddress​(java.lang.String server)
      • isEnableShutDownHook

        public static boolean isEnableShutDownHook()
        System property to control shutdown hook, issue #44
        Since:
        2.0.1
      • getServerString

        public static final java.lang.String getServerString​(java.net.InetSocketAddress addr)
        Create an unresolved server string (hostname:port) from an InetSocketAddress.