Package org.vibur.objectpool.util
Class MultithreadConcurrentQueueCollection<T>
java.lang.Object
org.vibur.objectpool.util.MultithreadConcurrentQueueCollection<T>
- Type Parameters:
T- the type of objects held in thisConcurrentCollection
- All Implemented Interfaces:
ConcurrentCollection<T>
public class MultithreadConcurrentQueueCollection<T>
extends Object
implements ConcurrentCollection<T>
A
MultithreadConcurrentQueue based implementation of ConcurrentCollection.- Author:
- Simeon Malchev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidofferFirst(T object) Adds the givenobjectat the head of theConcurrentCollection.voidAdds the givenobjectat the tail of theConcurrentCollection.Polls anobjectfrom the head of theConcurrentCollection.pollLast()Polls anobjectfrom the tail of theConcurrentCollection.intsize()Returns the number of elements in this collection.
-
Constructor Details
-
MultithreadConcurrentQueueCollection
public MultithreadConcurrentQueueCollection(int capacity)
-
-
Method Details
-
offerFirst
Description copied from interface:ConcurrentCollectionAdds the givenobjectat the head of theConcurrentCollection.- Specified by:
offerFirstin interfaceConcurrentCollection<T>- Parameters:
object- the given object
-
offerLast
Description copied from interface:ConcurrentCollectionAdds the givenobjectat the tail of theConcurrentCollection.- Specified by:
offerLastin interfaceConcurrentCollection<T>- Parameters:
object- the given object
-
pollFirst
Description copied from interface:ConcurrentCollectionPolls anobjectfrom the head of theConcurrentCollection.- Specified by:
pollFirstin interfaceConcurrentCollection<T>- Returns:
- the head Collection object if available;
nullotherwise
-
pollLast
Description copied from interface:ConcurrentCollectionPolls anobjectfrom the tail of theConcurrentCollection.- Specified by:
pollLastin interfaceConcurrentCollection<T>- Returns:
- the tail Collection object if available;
nullotherwise
-
size
public int size()Description copied from interface:ConcurrentCollectionReturns the number of elements in this collection.- Specified by:
sizein interfaceConcurrentCollection<T>- Returns:
- the number of elements in this collection
-