Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.resources.resource
Class ThreadPool

    java.lang.Object
      org.jini.rio.resources.resource.ResourcePool
          org.jini.rio.resources.resource.ThreadPool

    public class ThreadPool

extends ResourcePool

A resource pool to handle a pool of threads

Field Summary
`protected ThreadGroup` | `group`

Fields inherited from class org.jini.rio.resources.resource.ResourcePool
`alloced, freed, identifier, max, min, numCreated`

Constructor Summary
`ThreadPool(String identifier, int min, int max)` Create new named ThreadPool with a specified amount of minimum and maximum elements in the pool

Method Summary
`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

Methods inherited from class org.jini.rio.resources.resource.ResourcePool
`allocResource, createResource, createResources, createResources, disposeResource, freeResource, get, get, getAllocedSize, getFreedSize, getIdentifier, getInstance, getMax, getMin, getSize, register, register, register, release, remove, setIdentifier, setMax, setMin, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### group

    protected ThreadGroup group

Constructor Detail

### ThreadPool

    public ThreadPool(String identifier,
                      int min,
                      int max)

  Create new named ThreadPool with a specified amount of minimum and maximum elements in the pool

  Parameters:
    `identifier` - the unique identifier for this instance
    `min` - the minimum number of resources to create at startup
    `max` - the maximum number of resources allowed

Method Detail

### nextId

    protected static int nextId()

### create

    protected Object create()
                     throws ResourceUnavailableException

  method for creating a specific resource in the sub-class

  Specified by:
    `create` in class `ResourcePool`
  Returns:
    the resource
  Throws:
    `ResourceUnavailableException` - if an error occured in creating the resource

### dispose

    protected void dispose(Object obj)

  Dispose of a resource

  Specified by:
    `dispose` in class `ResourcePool`
  Parameters:
    `obj` - the resource to dispose

### validate

    protected boolean validate(Object obj)

  Validate a resource

  Specified by:
    `validate` in class `ResourcePool`
  Parameters:
    `obj` - the resource to validate
  Returns:
    true if resource is still valid

### getThreadGroup

    public ThreadGroup getThreadGroup()

  get the thread group for this pool

  Returns:
    the thread group for this pool

### destroy

    public void destroy()

  destroy all the threads spawned by this pool

### main

    public static void main(String[] args)

  Unit Test

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.