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 CombinedConfiguration
Stores the current configuration of the current thread.private final String
Stores the key of the configuration evaluated for the current thread at the beginning of an operation.private int
A counter for reentrant locks. -
Constructor Summary
ConstructorsConstructorDescriptionCurrentConfigHolder
(String curKey) Creates a new instance ofCurrentConfigHolder
and initializes it with the key for the current configuration. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Decrements the lock counter and checks whether it has reached 0.Gets the current configuration.getKey()
Gets the current key.void
Increments the lock counter.void
setCurrentConfiguration
(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 ofCurrentConfigHolder
and 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
-