Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * <strong>Not thread-safe</strong> {@link HttpProxyCacheServer} factory that returns single instance of proxy.
- *
- * @author Alexey Danilov (danikula@gmail.com).
- */
- public class ProxyFactory {
- private static HttpProxyCacheServer sharedProxy;
- private ProxyFactory() {
- }
- public static HttpProxyCacheServer getProxy(Context context) {
- return sharedProxy == null ? (sharedProxy = newProxy(context)) : sharedProxy;
- }
- private static HttpProxyCacheServer newProxy(Context context) {
- FileNameGenerator nameGenerator = new Md5FileNameGenerator(context.getExternalCacheDir());
- return new HttpProxyCacheServer(nameGenerator);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement