public class PropertiesBasedTimeouts extends Object implements Timeouts
Timeouts implementation based on Java properties.
This implementation accepts a Properties instance that contains properties in the following
form: 'com.atlassian.timeout.<TIMEOUT_TYPE>, where <TIMEOUT_TYPE> corresponds to a particular
field name of the TimeoutType enum.
At the very least, the properties are supposed to contain the TimeoutType.DEFAULT
value (which corresponds to the property key 'com.atlassian.timeout.DEFAULT'). If it is not present, an exception
will be raised from the constructor. This value will be used in place of whatever other timeout type that
does have corresponding value within the properties.
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_PROPERTY_KEY |
static String |
PROPERTY_PREFIX |
DEFAULT_INTERVAL| Constructor and Description |
|---|
PropertiesBasedTimeouts(InputStream reader)
Reads the properties from given reader.
|
PropertiesBasedTimeouts(Properties properties) |
| Modifier and Type | Method and Description |
|---|---|
static PropertiesBasedTimeouts |
fromClassPath(String path)
Load instance of PropertiesBasedTimeouts based on properties from a class path resource.
|
static PropertiesBasedTimeouts |
fromClassPath(String path,
ClassLoader loader)
Load instance of PropertiesBasedTimeouts based on properties from a class path resource.
|
static PropertiesBasedTimeouts |
fromFile(String path)
Load instance of PropertiesBasedTimeouts based on properties from file on disk.
|
long |
timeoutFor(TimeoutType timeoutType)
Provide timeout (in milliseconds) for a given timeoutType.
|
public static final String PROPERTY_PREFIX
public static final String DEFAULT_PROPERTY_KEY
public PropertiesBasedTimeouts(Properties properties)
public PropertiesBasedTimeouts(InputStream reader)
reader - reader to load properties frompublic static PropertiesBasedTimeouts fromFile(String path)
path - path of the properties filepublic static PropertiesBasedTimeouts fromClassPath(String path, ClassLoader loader)
path - path of the resourceloader - class loader to usepublic static PropertiesBasedTimeouts fromClassPath(String path)
path - path of the resourcepublic long timeoutFor(TimeoutType timeoutType)
TimeoutstimeoutFor in interface TimeoutstimeoutType - type of the timeoutCopyright © 2015 Atlassian. All rights reserved.