SynchronizedStack (Apache Tomcat 9.0.118 API Documentation)
Description: declaration: package: org.apache.tomcat.util.collections, class: SynchronizedStack

# Class SynchronizedStack<T>

java.lang.Object
org.apache.tomcat.util.collections.SynchronizedStack<T>

Type Parameters:
  `T` - The type of object managed by this stack

Direct Known Subclasses:
  `AbstractProtocol.RecycledProcessors`

public class SynchronizedStack<T> extends Object
This is intended as a (mostly) GC-free alternative to `Stack` when the requirement is to create a pool of re-usable objects with no requirement to shrink the pool. The aim is to provide the bare minimum of required functionality as quickly as possible with minimum garbage.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `DEFAULT_SIZE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SynchronizedStack()`
  `SynchronizedStack(int size, int limit)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  `T`
  `pop()`
  `boolean`
  `push(T obj)`
  `void`
  `setLimit(int limit)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DEFAULT_SIZE

    public static final int DEFAULT_SIZE
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SynchronizedStack

    public SynchronizedStack()

  - ### SynchronizedStack

    public SynchronizedStack(int size, int limit)

- ## Method Details

  - ### push

    public boolean push(T obj)

  - ### pop

    public T pop()

  - ### clear

    public void clear()

  - ### setLimit

    public void setLimit(int limit)