Class BufferedProxySelector


  • public class BufferedProxySelector
    extends java.net.ProxySelector
    Implements a cache that can be used to warp it around an existing ProxySelector. You can specify a maximum cache size and a "time to live" for positive resolves.
    • Constructor Detail

      • BufferedProxySelector

        public BufferedProxySelector​(int maxSize,
                                     long ttl,
                                     java.net.ProxySelector delegate,
                                     BufferedProxySelector.CacheScope cacheScope)
        Constructor
        Parameters:
        maxSize - the max size for the cache.
        ttl - the "time to live" for cache entries as amount in milliseconds.
        delegate - the delegate to use.
        cacheScope - the desired cache scope.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • connectFailed

        public void connectFailed​(java.net.URI uri,
                                  java.net.SocketAddress sa,
                                  java.io.IOException ioe)
        connectFailed
        Specified by:
        connectFailed in class java.net.ProxySelector
        See Also:
        ProxySelector.connectFailed(java.net.URI, java.net.SocketAddress, java.io.IOException)
      • select

        public java.util.List<java.net.Proxy> select​(java.net.URI uri)
        select
        Specified by:
        select in class java.net.ProxySelector
        See Also:
        ProxySelector.select(java.net.URI)
      • purgeCache

        private void purgeCache()
        Purge cache to get some free space for a new entry.