Package com.mongodb.internal.connection
Class ConcurrentPool<T>
- java.lang.Object
-
- com.mongodb.internal.connection.ConcurrentPool<T>
-
@Deprecated(since="2021-05-27") public class ConcurrentPool<T> extends java.lang.Object
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.A concurrent pool implementation.This class should not be considered a part of the public API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ConcurrentPool.ItemFactory<T>
Deprecated.Usage of this API is not supported in AEM as a Cloud Service.static class
ConcurrentPool.Prune
Deprecated.
-
Constructor Summary
Constructors Constructor Description ConcurrentPool(int maxSize, ConcurrentPool.ItemFactory<T> itemFactory)
Deprecated.Initializes a new pool of objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Deprecated.Clears the pool of all objects.void
ensureMinSize(int minSize, boolean initialize)
Deprecated.T
get()
Deprecated.Gets an object from the pool.T
get(long timeout, java.util.concurrent.TimeUnit timeUnit)
Deprecated.Gets an object from the pool - will block if none are availableint
getAvailableCount()
Deprecated.int
getCount()
Deprecated.int
getInUseCount()
Deprecated.int
getMaxSize()
Deprecated.void
prune()
Deprecated.void
release(T t)
Deprecated.Return an instance of T to the pool.void
release(T t, boolean prune)
Deprecated.call done when you are done with an object from the pool if there is room and the object is ok will get addedjava.lang.String
toString()
Deprecated.
-
-
-
Constructor Detail
-
ConcurrentPool
public ConcurrentPool(int maxSize, ConcurrentPool.ItemFactory<T> itemFactory)
Deprecated.Initializes a new pool of objects.- Parameters:
maxSize
- max to hold to at any given time. if < 0 then no limititemFactory
- factory used to create and close items in the pool
-
-
Method Detail
-
release
public void release(T t)
Deprecated.Return an instance of T to the pool. This method simply callsrelease(t, false)
- Parameters:
t
- item to return to the pool
-
release
public void release(T t, boolean prune)
Deprecated.call done when you are done with an object from the pool if there is room and the object is ok will get added- Parameters:
t
- item to return to the poolprune
- true if the item should be closed, false if it should be put back in the pool
-
get
public T get()
Deprecated.Gets an object from the pool. This method will block until a permit is available.- Returns:
- An object from the pool.
-
get
public T get(long timeout, java.util.concurrent.TimeUnit timeUnit)
Deprecated.Gets an object from the pool - will block if none are available- Parameters:
timeout
- negative - forever 0 - return immediately no matter what positive ms to waittimeUnit
- the time unit of the timeout- Returns:
- An object from the pool, or null if can't get one in the given waitTime
- Throws:
MongoTimeoutException
- if the timeout has been exceeded
-
prune
public void prune()
Deprecated.
-
ensureMinSize
public void ensureMinSize(int minSize, boolean initialize)
Deprecated.
-
close
public void close()
Deprecated.Clears the pool of all objects.
-
getMaxSize
public int getMaxSize()
Deprecated.
-
getInUseCount
public int getInUseCount()
Deprecated.
-
getAvailableCount
public int getAvailableCount()
Deprecated.
-
getCount
public int getCount()
Deprecated.
-
toString
public java.lang.String toString()
Deprecated.- Overrides:
toString
in classjava.lang.Object
-
-