Top Description Inners Methods
com.sun.istack

public Interface Pool<T>

Known Direct Implementers
com.sun.istack.Pool.Impl
Type Parameters
<T>
type
Imports
java.util.concurrent.ConcurrentLinkedQueue, java.lang.ref.WeakReference

Pool of reusable objects that are indistinguishable from each other, such as JAXB marshallers.
Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
Pool.Impl<
type
T
>

Default implementation that uses ConcurrentLinkedQueue as the data store.

Method Summary

Modifier and TypeMethod and Description
public void
recycle(T
object to put back to pool
t
)

Returns an object back to the pool.

public T

Returns:

an object from the pool
take
()

Gets a new object from the pool.

Method Detail

recycleback to summary
public void recycle(T t)

Returns an object back to the pool.

Parameters
t:T

object to put back to pool

takeback to summary
public T take()

Gets a new object from the pool.

If no object is available in the pool, this method creates a new one.

Returns:T

an object from the pool

Annotations
@NotNull
com.sun.istack back to summary

public abstract Class Pool.Impl<T>

extends Object
implements Pool<T>
Class Inheritance
All Implemented Interfaces
com.sun.istack.Pool
Type Parameters
<T>
type

Default implementation that uses ConcurrentLinkedQueue as the data store.

Note for Implementors

Don't rely on the fact that this class extends from ConcurrentLinkedQueue.

Field Summary

Modifier and TypeField and Description
private volatile WeakReference<ConcurrentLinkedQueue<T>>

Constructor Summary

AccessConstructor and Description
protected
Impl()

Create new Impl

Method Summary

Modifier and TypeMethod and Description
protected abstract T

Returns:

an object from an empty pool
create
()

Creates a new instance of object.

private ConcurrentLinkedQueue<T>
public final void
recycle(T
object to put back to the pool
t
)

Implements com.sun.istack.Pool.recycle.

Returns an object back to the pool.

public final T

Returns:

always non-null.
take
()

Implements com.sun.istack.Pool.take.

Gets a new object from the pool.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

queueback to summary
private volatile WeakReference<ConcurrentLinkedQueue<T>> queue

Constructor Detail

Implback to summary
protected Impl()

Create new Impl

Method Detail

createback to summary
protected abstract T create()

Creates a new instance of object.

This method is used when someone wants to take an object from an empty pool.

Also note that multiple threads may call this method concurrently.

Returns:T

an object from an empty pool

Annotations
@NotNull
getQueueback to summary
private ConcurrentLinkedQueue<T> getQueue()
recycleback to summary
public final void recycle(T t)

Implements com.sun.istack.Pool.recycle.

Returns an object back to the pool.

Parameters
t:T

object to put back to the pool

Annotations
@Override
takeback to summary
public final T take()

Implements com.sun.istack.Pool.take.

Gets a new object from the pool.

If no object is available in the pool, this method creates a new one.

Returns:T

always non-null.

Annotations
@Override
@NotNull