org.apache.jetspeed.services.threadpool
Class RunnableThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.apache.jetspeed.services.threadpool.RunnableThread
All Implemented Interfaces:
java.lang.Runnable

public class RunnableThread
extends java.lang.Thread

A thread that is used to process Runnables. This thread will wait until it is notified by another thread that it needs processing. However it will only process if getRunnable != null.

Version:
$Id: RunnableThread.java,v 1.8 2005/04/27 13:41:37 raphael Exp $
Author:
Kevin A. Burton, Santiago Gala

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RunnableThread()
           
RunnableThread(java.lang.ThreadGroup tg)
          Creates a new Thread in the specified threadgroup
RunnableThread(java.lang.ThreadGroup tg, int id)
          Creates a new Thread in the specified threadgroup and assigns it an id.
 
Method Summary
 java.lang.Runnable getRunnable()
          Get the Runnable process executing
 int getThreadId()
          Get the numeric identifier of this thread
 void run()
          Processes the Runnable object assigned to it, whenever one is available
 void setRunnable(java.lang.Runnable runnable)
          Set the Runnable process to execute
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Constructor Detail

RunnableThread

public RunnableThread()

RunnableThread

public RunnableThread(java.lang.ThreadGroup tg)
Creates a new Thread in the specified threadgroup

Parameters:
tg - the Threadgroup which will contain the new Thread

RunnableThread

public RunnableThread(java.lang.ThreadGroup tg,
                      int id)
Creates a new Thread in the specified threadgroup and assigns it an id.

Parameters:
tg - the Threadgroup which will contain the new Thread
id - an identifier for the new Thread
Method Detail

run

public void run()
Processes the Runnable object assigned to it, whenever one is available


setRunnable

public void setRunnable(java.lang.Runnable runnable)
Set the Runnable process to execute

Parameters:
runnable - the Object to execute

getRunnable

public java.lang.Runnable getRunnable()
Get the Runnable process executing

Returns:
the Object executed by this thread

getThreadId

public int getThreadId()
Get the numeric identifier of this thread

Returns:
the identifier of the thread


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.