Class BufferedProxySelector
java.lang.Object
java.net.ProxySelector
com.github.markusbernhardt.proxy.selector.misc.BufferedProxySelector
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic enumDefine the available scopes of the cache key generation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BufferedProxySelector.CacheScopeprivate ProxySelectorprivate intprivate long -
Constructor Summary
ConstructorsConstructorDescriptionBufferedProxySelector(int maxSize, long ttl, ProxySelector delegate, BufferedProxySelector.CacheScope cacheScope) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectFailed(URI uri, SocketAddress sa, IOException ioe) connectFailedprivate voidPurge cache to get some free space for a new entry.selecttoString()Methods inherited from class ProxySelector
getDefault, of, setDefault
-
Field Details
-
delegate
-
cache
-
maxSize
private int maxSize -
ttl
private long ttl -
cacheScope
-
-
Constructor Details
-
BufferedProxySelector
public BufferedProxySelector(int maxSize, long ttl, 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 Details
-
toString
-
connectFailed
connectFailed- Specified by:
connectFailedin classProxySelector- See Also:
-
select
-
purgeCache
private void purgeCache()Purge cache to get some free space for a new entry.
-