Class DequeRecycler<T>
- java.lang.Object
-
- org.elasticsearch.common.recycler.DequeRecycler<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Releasable
,Recycler<T>
- Direct Known Subclasses:
ConcurrentDequeRecycler
public class DequeRecycler<T> extends java.lang.Object
ARecycler
implementation based on aDeque
. This implementation is NOT thread-safe.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.recycler.Recycler
Recycler.C<T>, Recycler.Factory<T>, Recycler.V<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Recycler.C<T>
c
-
Constructor Summary
Constructors Constructor Description DequeRecycler(Recycler.C<T> c, java.util.Deque<T> queue, int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
afterRelease(boolean recycled)
Called after a release.protected boolean
beforeRelease()
Called before releasing an object, returns true if the object should be recycled and false otherwise.void
close()
Recycler.V<T>
obtain()
Recycler.V<T>
obtain(int sizing)
-
-
-
Field Detail
-
c
protected final Recycler.C<T> c
-
-
Constructor Detail
-
DequeRecycler
public DequeRecycler(Recycler.C<T> c, java.util.Deque<T> queue, int maxSize)
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceRecycler<T>
- Specified by:
close
in interfaceReleasable
-
obtain
public Recycler.V<T> obtain(int sizing)
-
beforeRelease
protected boolean beforeRelease()
Called before releasing an object, returns true if the object should be recycled and false otherwise.
-
afterRelease
protected void afterRelease(boolean recycled)
Called after a release.
-
obtain
public Recycler.V<T> obtain()
-
-