summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satserver/util/ProxyHandler.java
blob: f70a4965b2b1eafe27ba421b8d72d1208a2f1822 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.openslx.satserver.util;

import org.openslx.network.ProxyConfiguration;

/**
 * Class for handling proxy configuration in task manager.
 * 
 * @author bjoern
 * 
 */
public class ProxyHandler
{
	private static boolean hasDoneConfigProxy = false;
	private static final Object proxyMutex = new Object();

	/**
	 * Do proxy setup if not done already
	 */
	public static void configProxy()
	{
		configProxy( false );
	}

	/**
	 * Do proxy setup if not done already, or if explicitly forced.
	 * 
	 * @param force Do setup even if already done
	 */
	public static synchronized void configProxy( boolean force )
	{
		synchronized ( proxyMutex ) {
			if ( !hasDoneConfigProxy || force ) {
				ProxyConfiguration.configProxy();
				hasDoneConfigProxy = true;
			}
		}
	}
}