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 PoolableThread

    java.lang.Object
      java.lang.Thread
          org.jini.rio.resources.resource.PoolableThread

All Implemented Interfaces:
  Runnable

    public final class PoolableThread

extends Thread

An extension of Thread, PoolableThread instances know how to stay alive and wait in a pool

Nested Class Summary

Nested classes/interfaces inherited from class java.lang.Thread
`Thread.State, Thread.UncaughtExceptionHandler`

Field Summary
`protected static int` | `nextThreadID`
`protected ThreadPool` | `pool`
`protected Runnable` | `runObj` The runnable to run

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`PoolableThread(ThreadPool pool)` A thread that is a good pool citizen.

Method Summary
`void` | `cleanStop()` Set a flag to stop this thread, after a run.
`void` | `clearResources()` Clears the resource cache
`void` | `execute(Runnable runnable)` Define what to run, and wake up this dozing thread
`int` | `getID()` Return my id
`Object` | `getResource(Object key)` Return the resource for the specified key
`boolean` | `isReady()`
`void` | `joinResource()` Waits for the resource to complete
`Object` | `putResource(Object key, Object value)` Return the resource for the specified key
`void` | `run()` Wait in the pool, until someone needs this thread, then reenter pool.

Methods inherited from class java.lang.Thread
`activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield`

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

Field Detail

### nextThreadID

    protected static int nextThreadID

### pool

    protected ThreadPool pool

### runObj

    protected Runnable runObj

  The runnable to run

Constructor Detail

### PoolableThread

    public PoolableThread(ThreadPool pool)

  A thread that is a good pool citizen.

Method Detail

### isReady

    public boolean isReady()

### joinResource

    public void joinResource()
                      throws InterruptedException

  Waits for the resource to complete

  Throws:
    `InterruptedException`

### run

    public final void run()

  Wait in the pool, until someone needs this thread, then reenter pool. Do not override this method, use `execute` instead.

  Specified by:
    `run` in interface `Runnable`
  Overrides:
    `run` in class `Thread`

### execute

    public void execute(Runnable runnable)
                 throws IllegalStateException

  Define what to run, and wake up this dozing thread

  Throws:
    `IllegalStateException`

### cleanStop

    public void cleanStop()

  Set a flag to stop this thread, after a run.

### getID

    public int getID()

  Return my id

### getResource

    public Object getResource(Object key)

  Return the resource for the specified key

### putResource

    public Object putResource(Object key,
                              Object value)

  Return the resource for the specified key

### clearResources

    public void clearResources()

  Clears the resource cache

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.