Class DynamicCombinedConfiguration.CurrentConfigHolder
java.lang.Object
org.apache.commons.configuration2.DynamicCombinedConfiguration.CurrentConfigHolder
- Enclosing class:
DynamicCombinedConfiguration
A simple data class holding information about the current configuration while an operation for a thread is processed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CombinedConfigurationStores the current configuration of the current thread.private final StringStores the key of the configuration evaluated for the current thread at the beginning of an operation.private intA counter for reentrant locks. -
Constructor Summary
ConstructorsConstructorDescriptionCurrentConfigHolder(String curKey) Creates a new instance ofCurrentConfigHolderand initializes it with the key for the current configuration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDecrements the lock counter and checks whether it has reached 0.Gets the current configuration.getKey()Gets the current key.voidIncrements the lock counter.voidsetCurrentConfiguration(CombinedConfiguration currentConfiguration) Sets the current configuration.
-
Field Details
-
currentConfiguration
Stores the current configuration of the current thread. -
key
Stores the key of the configuration evaluated for the current thread at the beginning of an operation. -
lockCount
private int lockCountA counter for reentrant locks.
-
-
Constructor Details
-
CurrentConfigHolder
Creates a new instance ofCurrentConfigHolderand initializes it with the key for the current configuration.- Parameters:
curKey- the current key
-
-
Method Details
-
decrementLockCountAndCheckRelease
public boolean decrementLockCountAndCheckRelease()Decrements the lock counter and checks whether it has reached 0. In this cause, the operation is complete, and the lock can be released.- Returns:
- true if the lock count reaches 0, false otherwise
-
getCurrentConfiguration
Gets the current configuration.- Returns:
- the current configuration
-
getKey
Gets the current key.- Returns:
- the current key
-
incrementLockCount
public void incrementLockCount()Increments the lock counter. -
setCurrentConfiguration
Sets the current configuration.- Parameters:
currentConfiguration- the current configuration
-