SHOW:
|
|
- or go back to the newest paste.
| 1 | /** | |
| 2 | * <strong>Not thread-safe</strong> {@link HttpProxyCacheServer} factory that returns single instance of proxy.
| |
| 3 | * | |
| 4 | * @author Alexey Danilov ([email protected]). | |
| 5 | */ | |
| 6 | public class ProxyFactory {
| |
| 7 | ||
| 8 | private static HttpProxyCacheServer sharedProxy; | |
| 9 | ||
| 10 | private ProxyFactory() {
| |
| 11 | } | |
| 12 | ||
| 13 | public static HttpProxyCacheServer getProxy(Context context) {
| |
| 14 | return sharedProxy == null ? (sharedProxy = newProxy(context)) : sharedProxy; | |
| 15 | } | |
| 16 | ||
| 17 | private static HttpProxyCacheServer newProxy(Context context) {
| |
| 18 | - | FileNameGenerator nameGenerator = new Md5FileNameGenerator(context.getExternalCacheDir()); |
| 18 | + | return new HttpProxyCacheServer(context); |
| 19 | - | return new HttpProxyCacheServer(nameGenerator); |
| 19 | + | |
| 20 | } |