public abstract class

ThreadPool

extends Object
java.lang.Object
   ↳ com.mongodb.util.ThreadPool<T>

Summary

Public Constructors
ThreadPool(String name, int numThreads)
Initializes a new thread pool with a given name and number of threads.
ThreadPool(String name, int numThreads, int maxQueueSize)
Initializes a new thread pool with a given name, number of threads, and queue size.
Public Methods
abstract void handle(T t)
Handles a given object.
abstract void handleError(T t, Exception e)
Handles a given object and exception.
int inProgress()
int numThreads()
boolean offer(T t)
Adds a new object to the pool, if possible.
int queueSize()
Returns the size of the pool's queue.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ThreadPool (String name, int numThreads)

Initializes a new thread pool with a given name and number of threads.

Parameters
name identifying name
numThreads the number of threads allowed in the pool

public ThreadPool (String name, int numThreads, int maxQueueSize)

Initializes a new thread pool with a given name, number of threads, and queue size.

Parameters
name identifying name
numThreads the number of threads allowed in the pool
maxQueueSize the size of the pool entry queue

Public Methods

public abstract void handle (T t)

Handles a given object.

Parameters
t the object to handle
Throws
Exception

public abstract void handleError (T t, Exception e)

Handles a given object and exception.

Parameters
t the object to handle
e the exception to handle

public int inProgress ()

public int numThreads ()

public boolean offer (T t)

Adds a new object to the pool, if possible.

Parameters
t the object to be added
Returns
  • if the object was successfully added

public int queueSize ()

Returns the size of the pool's queue.

Returns
  • pool size