Top Description Fields Constructors Methods
org.apache.tomcat.util.collections

public Class SynchronizedStack<T>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.coyote.AbstractProtocol.RecycledProcessors
Type Parameters
<T>
The type of object managed by this stack

This is intended as a (mostly) GC-free alternative to java.util.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

Modifier and TypeField and Description
private static final int
public static final int
private int
private final int
private int
private Object[]

Constructor Summary

AccessConstructor and Description
public
public
SynchronizedStack(int size, int limit)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
private void
public synchronized T
pop()

public synchronized boolean
push(T obj)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_LIMITback to summary
private static final int DEFAULT_LIMIT
DEFAULT_SIZEback to summary
public static final int DEFAULT_SIZE
indexback to summary
private int index
limitback to summary
private final int limit
sizeback to summary
private int size
stackback to summary
private Object[] stack

Constructor Detail

SynchronizedStackback to summary
public SynchronizedStack()
SynchronizedStackback to summary
public SynchronizedStack(int size, int limit)

Method Detail

clearback to summary
public synchronized void clear()
expandback to summary
private void expand()
popback to summary
public synchronized T pop()
Annotations
@SuppressWarnings:unchecked
pushback to summary
public synchronized boolean push(T obj)