com.microsoft.tfs.core.config.tfproxy
Class DefaultTFProxyServerSettings

java.lang.Object
  extended by com.microsoft.tfs.core.config.tfproxy.DefaultTFProxyServerSettings
All Implemented Interfaces:
TFProxyServerSettings

public class DefaultTFProxyServerSettings
extends java.lang.Object
implements TFProxyServerSettings

A default implementation of the TFProxyServerSettings interface.

The user can provide a custom post-failure disabled period, which, when positive, causes the proxy to appear disabled (isAvailable() returns false) until a subsequent call to isAvailable() occurs after the configured period has elapsed.

If no disabled period is provided, DEFAULT_DISABLE_INTERVAL_MILLIS is used.

See Also:
TFProxyServerSettings
Since:
TEE-SDK-10.1
Thread-safety:
thread-safe

Field Summary
static long DEFAULT_DISABLE_INTERVAL_MILLIS
          The default length of the the post-failure disabled period, in milliseconds.
 
Constructor Summary
DefaultTFProxyServerSettings(java.lang.String url)
           
DefaultTFProxyServerSettings(java.lang.String url, long disableIntervalMillis)
          Creates a DefaultTFProxyServerSettings for the given URL with a custom post-failure disabled period.
 
Method Summary
 long getDisableInternalMillis()
           
 java.lang.String getURL()
          Called second by clients to determine a TF proxy server URL to use.
 boolean isAvailable()
          Called first by clients to determine whether this TFProxyServerSettings represents a TF proxy server that is available to be used.
 void recordFailure()
          Clients must call this method if a download fails because of a TF proxy server.
 void setURL(java.lang.String url)
          Sets the proxy server URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DISABLE_INTERVAL_MILLIS

public static final long DEFAULT_DISABLE_INTERVAL_MILLIS
The default length of the the post-failure disabled period, in milliseconds.

Constant Field Value:
300000L
See Also:
Constant Field Values
Constructor Detail

DefaultTFProxyServerSettings

public DefaultTFProxyServerSettings(java.lang.String url)

DefaultTFProxyServerSettings

public DefaultTFProxyServerSettings(java.lang.String url,
                                    long disableIntervalMillis)
Creates a DefaultTFProxyServerSettings for the given URL with a custom post-failure disabled period.

Parameters:
url - the URL string of the proxy server (pass null to disable the proxy server)
disableIntervalMillis - the length of the post-failure disabled period, in milliseconds
Method Detail

setURL

public void setURL(java.lang.String url)
Sets the proxy server URL.

Parameters:
url - the URL string of the proxy server (pass null to disable the proxy server)

getDisableInternalMillis

public long getDisableInternalMillis()
Returns:
the post-failure disabled period length in milliseconds

recordFailure

public void recordFailure()
Clients must call this method if a download fails because of a TF proxy server. Calling this method gives TFProxyServerSettings a chance to enforce a failure policy. See the javadoc for this class for the algorithm that clients should follow when using a TFProxyServerSettings instance.

Specified by:
recordFailure in interface TFProxyServerSettings

isAvailable

public boolean isAvailable()
Called first by clients to determine whether this TFProxyServerSettings represents a TF proxy server that is available to be used. As noted above, the result of this method can change at any time.

Specified by:
isAvailable in interface TFProxyServerSettings
Returns:
true if there is a TF proxy server available to be used at the time of this method call

getURL

public java.lang.String getURL()
Called second by clients to determine a TF proxy server URL to use. Note that even if TFProxyServerSettings.isAvailable() returns true, clients must still be prepared for a null return value from this method, which indicates that the TF proxy server became unavailable in between method calls. A non-null return can be used for a single download as a TF proxy URL.

Specified by:
getURL in interface TFProxyServerSettings
Returns:
a TF proxy URL or null


© 2015 Microsoft. All rights reserved.