Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.spi
Class MutableThreadContextStack

    java.lang.Object
      org.apache.logging.log4j.spi.MutableThreadContextStack

All Implemented Interfaces:
  Serializable, Iterable<String>, Collection<String>, ThreadContextStack, ThreadContext.ContextStack

    public class MutableThreadContextStack

extends Object
implements ThreadContextStack

See Also:
  Serialized Form

Constructor Summary
`MutableThreadContextStack()` Constructs an empty MutableThreadContextStack.
`MutableThreadContextStack(List<String> list)`

Method Summary
`boolean` | `add(String s)`
`boolean` | `addAll(Collection<? extends String> strings)`
`List<String>` | `asList()` Returns all the elements in the stack in a List.
`void` | `clear()`
`boolean` | `contains(Object o)`
`boolean` | `containsAll(Collection<?> objects)`
`ThreadContextStack` | `copy()` Returns a copy of the ContextStack.
`boolean` | `equals(Object obj)`
`void` | `freeze()` "Freezes" this context stack so it becomes immutable: all mutator methods will throw an exception from now on.
`int` | `getDepth()` Returns the number of elements in the stack.
`ThreadContext.ContextStack` | `getImmutableStackOrNull()` Returns a ContextStack with the same contents as this ContextStack or `null`.
`int` | `hashCode()`
`boolean` | `isEmpty()`
`boolean` | `isFrozen()`
`Iterator<String>` | `iterator()`
`String` | `peek()` Returns the element at the top of the stack without removing it or null if the stack is empty.
`String` | `pop()` Returns the element at the top of the stack.
`void` | `push(String message)` Pushes an element onto the stack.
`boolean` | `remove(Object o)`
`boolean` | `removeAll(Collection<?> objects)`
`boolean` | `retainAll(Collection<?> objects)`
`int` | `size()`
`Object[]` | `toArray()`
`
`<T> T[]`
` | `toArray(T[] ts)`
`String` | `toString()`
`void` | `trim(int depth)` Trims elements from the end of the stack.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MutableThreadContextStack

    public MutableThreadContextStack()

  Constructs an empty MutableThreadContextStack.

### MutableThreadContextStack

    public MutableThreadContextStack(List<String> list)

Method Detail

### pop

    public String pop()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns the element at the top of the stack.

  Specified by:
    `pop` in interface `ThreadContext.ContextStack`
  Returns:
    The element at the top of the stack.

### peek

    public String peek()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns the element at the top of the stack without removing it or null if the stack is empty.

  Specified by:
    `peek` in interface `ThreadContext.ContextStack`
  Returns:
    the element at the top of the stack or null if the stack is empty.

### push

    public void push(String message)

  Description copied from interface: `ThreadContext.ContextStack`
  Pushes an element onto the stack.

  Specified by:
    `push` in interface `ThreadContext.ContextStack`
  Parameters:
    `message` - The element to add.

### getDepth

    public int getDepth()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns the number of elements in the stack.

  Specified by:
    `getDepth` in interface `ThreadContext.ContextStack`
  Returns:
    the number of elements in the stack.

### asList

    public List<String> asList()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns all the elements in the stack in a List.

  Specified by:
    `asList` in interface `ThreadContext.ContextStack`
  Returns:
    all the elements in the stack in a List.

### trim

    public void trim(int depth)

  Description copied from interface: `ThreadContext.ContextStack`
  Trims elements from the end of the stack.

  Specified by:
    `trim` in interface `ThreadContext.ContextStack`
  Parameters:
    `depth` - The maximum number of items in the stack to keep.

### copy

    public ThreadContextStack copy()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns a copy of the ContextStack.

  Specified by:
    `copy` in interface `ThreadContext.ContextStack`
  Returns:
    a copy of the ContextStack.

### clear

    public void clear()

  Specified by:
    `clear` in interface `Collection<String>`

### size

    public int size()

  Specified by:
    `size` in interface `Collection<String>`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Collection<String>`

### contains

    public boolean contains(Object o)

  Specified by:
    `contains` in interface `Collection<String>`

### iterator

    public Iterator<String> iterator()

  Specified by:
    `iterator` in interface `Iterable<String>`
  Specified by:
    `iterator` in interface `Collection<String>`

### toArray

    public Object[] toArray()

  Specified by:
    `toArray` in interface `Collection<String>`

### toArray

    public <T> T[] toArray(T[] ts)

  Specified by:
    `toArray` in interface `Collection<String>`

### add

    public boolean add(String s)

  Specified by:
    `add` in interface `Collection<String>`

### remove

    public boolean remove(Object o)

  Specified by:
    `remove` in interface `Collection<String>`

### containsAll

    public boolean containsAll(Collection<?> objects)

  Specified by:
    `containsAll` in interface `Collection<String>`

### addAll

    public boolean addAll(Collection<? extends String> strings)

  Specified by:
    `addAll` in interface `Collection<String>`

### removeAll

    public boolean removeAll(Collection<?> objects)

  Specified by:
    `removeAll` in interface `Collection<String>`

### retainAll

    public boolean retainAll(Collection<?> objects)

  Specified by:
    `retainAll` in interface `Collection<String>`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Collection<String>`
  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Specified by:
    `equals` in interface `Collection<String>`
  Overrides:
    `equals` in class `Object`

### getImmutableStackOrNull

    public ThreadContext.ContextStack getImmutableStackOrNull()

  Description copied from interface: `ThreadContext.ContextStack`
  Returns a ContextStack with the same contents as this ContextStack or `null`. Attempts to modify the returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.

  Specified by:
    `getImmutableStackOrNull` in interface `ThreadContext.ContextStack`
  Returns:
    a ContextStack with the same contents as this ContextStack or `null`.

### freeze

    public void freeze()

  "Freezes" this context stack so it becomes immutable: all mutator methods will throw an exception from now on.

### isFrozen

    public boolean isFrozen()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.