Class AppenderControlArraySet
- java.lang.Object
-
- org.apache.logging.log4j.core.config.AppenderControlArraySet
-
public class AppenderControlArraySet extends java.lang.ObjectData structure with similar semantics to CopyOnWriteArraySet, but giving direct access to the underlying array.- Since:
- 2.6
-
-
Field Summary
Fields Modifier and Type Field Description private AppenderControl[]appenderArrayprivate static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<AppenderControlArraySet,AppenderControl[]>appenderArrayUpdater
-
Constructor Summary
Constructors Constructor Description AppenderControlArraySet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(AppenderControl control)Adds an AppenderControl to this set.java.util.Map<java.lang.String,Appender>asMap()Returns all Appenders as a Map.AppenderControl[]clear()Atomically sets the values to an empty array and returns the old array.AppenderControl[]get()Returns the underlying array.booleanisEmpty()AppenderControlremove(java.lang.String name)Removes the AppenderControl with the specific name and returns it (ornullif no such appender existed).private AppenderControl[]removeElementAt(int i, AppenderControl[] array)java.lang.StringtoString()
-
-
-
Field Detail
-
appenderArrayUpdater
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<AppenderControlArraySet,AppenderControl[]> appenderArrayUpdater
-
appenderArray
private volatile AppenderControl[] appenderArray
-
-
Method Detail
-
add
public boolean add(AppenderControl control)
Adds an AppenderControl to this set. If this set already contains the element, the call leaves the set unchanged and returns false.- Parameters:
control- The AppenderControl to add.- Returns:
- true if this set did not already contain the specified element
-
remove
public AppenderControl remove(java.lang.String name)
Removes the AppenderControl with the specific name and returns it (ornullif no such appender existed).- Parameters:
name- The name of the AppenderControl to remove- Returns:
- the removed AppenderControl or
null
-
removeElementAt
private AppenderControl[] removeElementAt(int i, AppenderControl[] array)
-
asMap
public java.util.Map<java.lang.String,Appender> asMap()
Returns all Appenders as a Map.- Returns:
- a Map with the Appender name as the key and the Appender as the value.
-
clear
public AppenderControl[] clear()
Atomically sets the values to an empty array and returns the old array.- Returns:
- the contents before this collection was cleared.
-
isEmpty
public boolean isEmpty()
-
get
public AppenderControl[] get()
Returns the underlying array.- Returns:
- the array supporting this collection
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-