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 class
static enum
Define the available scopes of the cache key generation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BufferedProxySelector.CacheScope
private ProxySelector
private int
private long
-
Constructor Summary
ConstructorsConstructorDescriptionBufferedProxySelector
(int maxSize, long ttl, ProxySelector delegate, BufferedProxySelector.CacheScope cacheScope) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
connectFailed
(URI uri, SocketAddress sa, IOException ioe) connectFailedprivate void
Purge cache to get some free space for a new entry.selecttoString()
Methods inherited from class java.net.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:
connectFailed
in classProxySelector
- See Also:
-
select
select- Specified by:
select
in classProxySelector
- See Also:
-
purgeCache
private void purgeCache()Purge cache to get some free space for a new entry.
-