javax.media.j3d
Class J3dThread

java.lang.Object
  extended by java.lang.Thread
      extended by javax.media.j3d.J3dThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
BehaviorScheduler, InputDeviceScheduler, Renderer, StructureUpdateThread

abstract class J3dThread
extends java.lang.Thread

The J3dThread is the super class of all slave threads in Java 3D. It implements all of the common flow control constructs.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  boolean active
          This indicates that this thread has been activated by MC
(package private)  java.lang.Object[] args
          The arguments passed in for this thread
(package private) static int BEHAVIOR_SCHEDULER
          These are the thread types that a message may affect
(package private)  int classification
          The classification of this thread.
private  J3dThreadData[] data
          The thread data for this thread
(package private) static int INPUT_DEVICE_SCHEDULER
           
private  int instanceNum
           
(package private)  long lastWaitTimestamp
          Use to assign threadOpts WAIT_ALL_THREADS
(package private) static int NOTIFY
          This is used by Canvas3D Renderer to notify user thread that swap is completed.
(package private) static int NOTIFY_AND_WAIT
          This runMonitor action notifies MasterControl that this thread has completed and wait.
private static int numInstances
          Some variables used to name threads correctly
private  boolean ready
          This flag is set by the RUN action of runMonitor to indicate that the waiting thread has work to do.
(package private)  long referenceTime
          The time values passed into this thread
(package private) static int RENDER_THREAD
           
(package private) static int RUN
          This runMonitor action tells the thread to run N number of iterations.
private  boolean running
          This indicates that this thread is alive and running
(package private) static int SOUND_SCHEDULER
           
private  boolean started
          This indicates that this thread is started and able to accept work
(package private) static int STOP
          This runMonitor action tells the thread to stop running
(package private)  int type
          The type of this thread.
(package private) static int UPDATE_BEHAVIOR
           
(package private) static int UPDATE_GEOMETRY
           
(package private) static int UPDATE_RENDER
           
(package private) static int UPDATE_RENDERING_ATTRIBUTES
           
(package private) static int UPDATE_RENDERING_ENVIRONMENT
           
(package private) static int UPDATE_SOUND
           
(package private) static int UPDATE_THREAD
           
(package private) static int UPDATE_TRANSFORM
           
(package private)  boolean userStop
          Flag to indicate that user initiate a thread stop
(package private) static int WAIT
          This runMonitor action puts the thread into an initial wait state
private  boolean waiting
          Flag to indicate that this thread is waiting to be notify
(package private) static int WORK_THREAD
          The classification types.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
J3dThread(java.lang.ThreadGroup t)
          This constructor simply assigns the given id.
 
Method Summary
(package private)  void cleanup()
           
(package private)  void cleanupView()
           
(package private) abstract  void doWork(long referenceTime)
          This method is defined by all slave threads to implement one iteration of work.
(package private)  void finish()
          This causes the threads run method to exit.
(package private)  int getInstanceNum()
           
(package private)  J3dThreadData getThreadData(View v, Canvas3D c)
          This returns the thread data for this thread.
(package private)  void initialize()
          This initializes this thread.
private  int newInstanceNum()
           
 void run()
          This thread controls the syncing of all the canvases attached to this view.
(package private)  void runMonitor(int action, long referenceTime, java.lang.Object[] args)
           
(package private)  void shutdown()
           
 
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

BEHAVIOR_SCHEDULER

static final int BEHAVIOR_SCHEDULER
These are the thread types that a message may affect

See Also:
Constant Field Values

SOUND_SCHEDULER

static final int SOUND_SCHEDULER
See Also:
Constant Field Values

INPUT_DEVICE_SCHEDULER

static final int INPUT_DEVICE_SCHEDULER
See Also:
Constant Field Values

RENDER_THREAD

static final int RENDER_THREAD
See Also:
Constant Field Values

UPDATE_GEOMETRY

static final int UPDATE_GEOMETRY
See Also:
Constant Field Values

UPDATE_RENDER

static final int UPDATE_RENDER
See Also:
Constant Field Values

UPDATE_BEHAVIOR

static final int UPDATE_BEHAVIOR
See Also:
Constant Field Values

UPDATE_SOUND

static final int UPDATE_SOUND
See Also:
Constant Field Values

UPDATE_RENDERING_ATTRIBUTES

static final int UPDATE_RENDERING_ATTRIBUTES
See Also:
Constant Field Values

UPDATE_RENDERING_ENVIRONMENT

static final int UPDATE_RENDERING_ENVIRONMENT
See Also:
Constant Field Values

UPDATE_TRANSFORM

static final int UPDATE_TRANSFORM
See Also:
Constant Field Values

WORK_THREAD

static final int WORK_THREAD
The classification types.

See Also:
Constant Field Values

UPDATE_THREAD

static final int UPDATE_THREAD
See Also:
Constant Field Values

WAIT

static final int WAIT
This runMonitor action puts the thread into an initial wait state

See Also:
Constant Field Values

NOTIFY_AND_WAIT

static final int NOTIFY_AND_WAIT
This runMonitor action notifies MasterControl that this thread has completed and wait.

See Also:
Constant Field Values

NOTIFY

static final int NOTIFY
This is used by Canvas3D Renderer to notify user thread that swap is completed.

See Also:
Constant Field Values

RUN

static final int RUN
This runMonitor action tells the thread to run N number of iterations.

See Also:
Constant Field Values

STOP

static final int STOP
This runMonitor action tells the thread to stop running

See Also:
Constant Field Values

active

boolean active
This indicates that this thread has been activated by MC


running

private volatile boolean running
This indicates that this thread is alive and running


ready

private volatile boolean ready
This flag is set by the RUN action of runMonitor to indicate that the waiting thread has work to do.


data

private J3dThreadData[] data
The thread data for this thread


started

private volatile boolean started
This indicates that this thread is started and able to accept work


referenceTime

long referenceTime
The time values passed into this thread


lastWaitTimestamp

long lastWaitTimestamp
Use to assign threadOpts WAIT_ALL_THREADS


type

int type
The type of this thread. It is one of the above constants.


classification

int classification
The classification of this thread. It is one of the above constants.


args

java.lang.Object[] args
The arguments passed in for this thread


userStop

volatile boolean userStop
Flag to indicate that user initiate a thread stop


waiting

private volatile boolean waiting
Flag to indicate that this thread is waiting to be notify


numInstances

private static int numInstances
Some variables used to name threads correctly


instanceNum

private int instanceNum
Constructor Detail

J3dThread

J3dThread(java.lang.ThreadGroup t)
This constructor simply assigns the given id.

Method Detail

newInstanceNum

private int newInstanceNum()

getInstanceNum

int getInstanceNum()

doWork

abstract void doWork(long referenceTime)
This method is defined by all slave threads to implement one iteration of work.


getThreadData

J3dThreadData getThreadData(View v,
                            Canvas3D c)
This returns the thread data for this thread.


initialize

void initialize()
This initializes this thread. Once this method returns, the thread is able to accept work.


finish

void finish()
This causes the threads run method to exit.


run

public void run()
This thread controls the syncing of all the canvases attached to this view.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

runMonitor

void runMonitor(int action,
                long referenceTime,
                java.lang.Object[] args)

cleanupView

void cleanupView()

shutdown

void shutdown()

cleanup

void cleanup()


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.