public class ThreadPool extends ResourcePool
Modifier and Type | Field and Description |
---|---|
protected ThreadGroup |
group |
alloced, freed, identifier, max, min, numCreated
Constructor and Description |
---|
ThreadPool(String identifier,
int min,
int max)
Create new named ThreadPool with a specified amount of minimum and maximum elements in the
pool
|
Modifier and Type | Method and Description |
---|---|
protected Object |
create()
method for creating a specific resource in the sub-class
|
void |
destroy()
destroy all the threads spawned by this pool
|
protected void |
dispose(Object obj)
Dispose of a resource
|
ThreadGroup |
getThreadGroup()
get the thread group for this pool
|
static void |
main(String[] args)
Unit Test
|
protected static int |
nextId() |
protected boolean |
validate(Object obj)
Validate a resource
|
allocResource, createResource, createResources, createResources, disposeResource, freeResource, get, get, getAllocedOfType, getAllocedSize, getFreedSize, getIdentifier, getInstance, getMax, getMin, getSize, register, register, register, release, remove, setIdentifier, setMax, setMin, toString
protected ThreadGroup group
public ThreadPool(String identifier, int min, int max)
identifier
- the unique identifier for this instancemin
- the minimum number of resources to create at startupmax
- the maximum number of resources allowedprotected static int nextId()
protected Object create() throws ResourceUnavailableException
create
in class ResourcePool
ResourceUnavailableException
- if an error occured in creating the resourceprotected void dispose(Object obj)
dispose
in class ResourcePool
obj
- the resource to disposeprotected boolean validate(Object obj)
validate
in class ResourcePool
obj
- the resource to validatepublic ThreadGroup getThreadGroup()
public void destroy()
public static void main(String[] args)
Copyright © GigaSpaces.