Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
/*
* Portions of this code were derived from work done by the Blackdown
* group (www.blackdown.org), who did the initial Linux implementation
* of the Java 3D API.
*/
package javax.media.j3d;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.logging.Level;
import java.util.logging.Logger;
class MasterControl {
/**
* Options for the runMonitor
*/
static final int CHECK_FOR_WORK = 0;
static final int SET_WORK = 1;
static final int RUN_THREADS = 2;
static final int THREAD_DONE = 3;
static final int SET_WORK_FOR_REQUEST_RENDERER = 5;
static final int RUN_RENDERER_CLEANUP = 6;
// The thread states for MC
static final int SLEEPING = 0;
static final int RUNNING = 1;
static final int WAITING_FOR_THREADS = 3;
static final int WAITING_FOR_CPU = 4;
static final int WAITING_FOR_RENDERER_CLEANUP = 5;
// Constants used in renderer thread argument
static final Integer REQUESTRENDER = new Integer(Renderer.REQUESTRENDER);
static final Integer RENDER = new Integer(Renderer.RENDER);
static final Integer SWAP = new Integer(Renderer.SWAP);
// Constants used for request from user threads
static final Integer ACTIVATE_VIEW = new Integer(1);
static final Integer DEACTIVATE_VIEW = new Integer(2);
static final Integer START_VIEW = new Integer(3);
static final Integer STOP_VIEW = new Integer(4);
static final Integer REEVALUATE_CANVAS = new Integer(5);
static final Integer UNREGISTER_VIEW = new Integer(6);
static final Integer PHYSICAL_ENV_CHANGE = new Integer(7);
static final Integer INPUTDEVICE_CHANGE = new Integer(8);
static final Integer EMPTY_UNIVERSE = new Integer(9);
static final Integer START_RENDERER = new Integer(10);
static final Integer STOP_RENDERER = new Integer(11);
static final Integer RENDER_ONCE = new Integer(12);
static final Integer FREE_CONTEXT = new Integer(13);
static final Integer FREE_DRAWING_SURFACE = new Integer(14);
static final Integer FREE_MESSAGE = new Integer(15);
static final Integer RESET_CANVAS = new Integer(16);
static final Integer GETBESTCONFIG = new Integer(17);
static final Integer ISCONFIGSUPPORT = new Integer(18);
static final Integer SET_GRAPHICSCONFIG_FEATURES = new Integer(19);
static final Integer SET_QUERYPROPERTIES = new Integer(20);
static final Integer SET_VIEW = new Integer(21);
// Developer logger for reporting informational messages; see getDevLogger()
private static boolean devLoggerEnabled = false;
private static Logger devLogger;
// Stats logger for reporting runtime statistics; see getStatsLogger()
private static boolean statsLoggerEnabled = false;
private static Logger statsLogger;
// Core logger for reporting internal errors, warning, and
// informational messages; see getCoreLogger()
private static boolean coreLoggerEnabled = false;
private static Logger coreLogger;
// Flag indicating that the rendering pipeline libraries are loaded
private static boolean librariesLoaded = false;
/**
* reference to MasterControl thread
*/
private MasterControlThread mcThread = null;
/**
* The list of views that are currently registered
*/
private UnorderList views = new UnorderList(1, View.class);
/**
* by MIK OF CLASSX
*
* the flag to indicate whether the background of the offscreen
* canvas must be transparent or not false by default
*/
boolean transparentOffScreen = false;
/**
* Flag to indicate whether Pbuffers are used for off-screen
* rendering; true by default. Set by the "j3d.usePbuffer"
* property, When this flag is set to false, Bitmap (Windows) or
* Pixmap (UNIX) rendering will be used
*/
boolean usePbuffer = true;
/**
* Flag to indicate whether should renderer view frustum culling is done;
* true by default.
* Set by the -Dj3d.viewFrustumCulling property, When this flag is
* set to false, the renderer view frustum culling is turned off.
*/
boolean viewFrustumCulling = true;
/**
* the flag to indicate whether the geometry should be locked or not
*/
private boolean lockGeometry = false;
/**
* The number of registered views that are active
*/
private int numActiveViews = 0;
/**
* The list of active universes get from View
*/
private UnorderList activeUniverseList = new UnorderList(VirtualUniverse.class);
/**
* The list of universes register from View
*/
private UnorderList regUniverseList = new UnorderList(VirtualUniverse.class);
/**
* A lock used for accessing time structures.
*/
private Object timeLock = new Object();
/**
* The current "time" value
*/
private long time = 0;
/**
* Use to assign threadOpts in Renderer thread.
*/
private long waitTimestamp = 0;
/**
* The current list of work threads
*/
private UnorderList stateWorkThreads =
new UnorderList(J3dThreadData.class);
private UnorderList renderWorkThreads =
new UnorderList(J3dThreadData.class);
private UnorderList requestRenderWorkThreads =
new UnorderList(J3dThreadData.class);
/**
* The current list of work threads
*/
private UnorderList renderThreadData = new UnorderList(J3dThreadData.class);
/**
* The list of input device scheduler thread
*/
private UnorderList inputDeviceThreads =
new UnorderList(1, InputDeviceScheduler.class);
/**
* A flag that is true when the thread lists need updating
*/
private boolean threadListsChanged;
/**
* Markers for the last transform structure update thread
* and the last update thread.
*/
private int lastTransformStructureThread = 0;
private int lastStructureUpdateThread = 0;
/**
* The current time snapshots
*/
private long currentTime;
// Only one Timer thread in the system.
TimerThread timerThread;
// Only one Notification thread in the system.
private NotificationThread notificationThread;
/**
* This flag indicates that MC is running
*/
volatile boolean running = true;
/**
* This flag indicates that MC has work to do
*/
private boolean workToDo = false;
/**
* This flag indicates that there is work for requestRenderer
*/
private boolean requestRenderWorkToDo = false;
/**
* The number of THREAD_DONE messages pending
*/
private int threadPending = 0;
private int renderPending = 0;
private int statePending = 0;
/**
* State variables for work lists
*/
private boolean renderWaiting = false;
private boolean stateWaiting = false;
/**
* The current state of the MC thread
*/
private int state = SLEEPING;
// time for sleep in order to met the minimum frame duration
private long sleepTime = 0;
/**
* The number of cpu's Java 3D may use
*/
private int cpuLimit;
/**
* A list of mirror objects to be updated
*/
private UnorderList mirrorObjects = new UnorderList(ObjectUpdate.class);
/**
* The renderingAttributesStructure for updating node component
* objects
*/
private RenderingAttributesStructure renderingAttributesStructure =
new RenderingAttributesStructure();
/**
* The default rendering method
*/
private DefaultRenderMethod defaultRenderMethod = null;
/**
* The text3D rendering method
*/
private Text3DRenderMethod text3DRenderMethod = null;
/**
* The vertex array rendering method
*/
private VertexArrayRenderMethod vertexArrayRenderMethod = null;
/**
* The displayList rendering method
*/
private DisplayListRenderMethod displayListRenderMethod = null;
/**
* The compressed geometry rendering method
*/
private CompressedGeometryRenderMethod compressedGeometryRenderMethod = null;
/**
* The oriented shape3D rendering method
*/
private OrientedShape3DRenderMethod orientedShape3DRenderMethod = null;
/**
* This is the start time upon which alpha's and behaviors
* are synchronized to. It is initialized once, the first time
* that a MasterControl object is created.
*/
static long systemStartTime = 0L;
// This is a time stamp used when context is created
private long contextTimeStamp = 0;
// This is an array of canvasIds in used
private boolean[] canvasIds = null;
private int canvasFreeIndex = 0;
private Object canvasIdLock = new Object();
// This is a counter for rendererBit
private int rendererCount = 0;
// Flag that indicates whether to shared display context or not
boolean isSharedCtx = false;
// Flag that tells us to use NV_register_combiners
boolean useCombiners = false;
// Flag that indicates whether compile is disabled or not
boolean disableCompile = false;
// Flag that indicates whether or not compaction occurs
boolean doCompaction = true;
// Flag that indicates whether separate specular color is disabled or not
boolean disableSeparateSpecularColor = false;
// Flag that indicates whether DisplayList is used or not
boolean isDisplayList = true;
// If this flag is set, then by-ref geometry will not be
// put in display list
boolean buildDisplayListIfPossible = false;
// If this flag is set, then geometry arrays with vertex attributes can
// be in display list.
boolean vertexAttrsInDisplayList = false;
// Issue 249 - flag that indicates whether the soleUser optimization is permitted
boolean allowSoleUser = false;
// Issue 266 - Flag indicating whether null graphics configs are allowed
// Set by -Dj3d.allowNullGraphicsConfig property
// Setting this flag causes Canvas3D to allow a null GraphicsConfiguration
// for on-screen canvases. This is only for backward compatibility with
// legacy applications.
boolean allowNullGraphicsConfig = false;
// Issue 239 - Flag indicating whether the stencil buffer is cleared by
// default each frame when the color and depth buffers are cleared.
// Note that this is a partial solution, since we eventually want an API
// to control this.
boolean stencilClear = false;
// REQUESTCLEANUP messages argument
static Integer REMOVEALLCTXS_CLEANUP = new Integer(1);
static Integer REMOVECTX_CLEANUP = new Integer(2);
static Integer REMOVENOTIFY_CLEANUP = new Integer(3);
static Integer RESETCANVAS_CLEANUP = new Integer(4);
static Integer FREECONTEXT_CLEANUP = new Integer(5);
// arguments for renderer resource cleanup run
Object rendererCleanupArgs[] = {new Integer(Renderer.REQUESTCLEANUP),
null, null};
// Context creation should obtain this lock, so that
// first_time and all the extension initilialization
// are done in the MT safe manner
Object contextCreationLock = new Object();
// Flag that indicates whether to lock the DSI while rendering
boolean doDsiRenderLock = false;
// Flag that indicates the pre-1.5 behavior of enforcing power-of-two
// textures. If set, then any non-power-of-two textures will throw an
// exception.
boolean enforcePowerOfTwo = false;
// Flag that indicates whether the framebuffer is sharing the
// Z-buffer with both the left and right eyes when in stereo mode.
// If this is true, we need to clear the Z-buffer between rendering
// to the left and right eyes.
boolean sharedStereoZBuffer = true;
// True to disable all underlying multisampling API so it uses
// the setting in the driver.
boolean implicitAntialiasing = false;
// False to disable compiled vertex array extensions if support
boolean isCompiledVertexArray = true;
// Number of reserved vertex attribute locations for GLSL (must be at
// least 1).
// Issue 269 - need to reserve up to 6 vertex attribtue locations to ensure
// that we don't collide with a predefined gl_* attribute on nVidia cards.
int glslVertexAttrOffset = 6;
// Hashtable that maps a GraphicsDevice to its associated
// Screen3D--this is only used for on-screen Canvas3Ds
Hashtable deviceScreenMap = new Hashtable();
// Use to store all requests from user threads.
UnorderList requestObjList = new UnorderList();
private UnorderList requestTypeList = new UnorderList(Integer.class);
// Temporary storage to store stop request for requestViewList
private UnorderList tempViewList = new UnorderList();
private UnorderList renderOnceList = new UnorderList();
// This flag is true when there is pending request
// i.e. false when the above requestxxx Lists are all empty.
private boolean pendingRequest = false;
// Root ThreadGroup for creating Java 3D threads
private static ThreadGroup rootThreadGroup;
// Thread priority for all Java 3D threads
private static int threadPriority;
static private Object mcThreadLock = new Object();
private ArrayList timestampUpdateList = new ArrayList(3);
private UnorderList freeMessageList = new UnorderList(8);
// Maximum number of lights
int maxLights;
// Set by the -Dj3d.sortShape3DBounds property, When this flag is
// set to true, the bounds of the Shape3D node will be used in
// place of the computed GeometryArray bounds for transparency
// sorting for those Shape3D nodes whose boundsAutoCompute
// attribute is set to false.
boolean sortShape3DBounds = false;
//Set by -Dj3d.forceReleaseView property.
//Setting this flag as true disables the bug fix 4267395 in View deactivate().
//The bug 4267395 can lock-up *some* systems, but the bug fix can
//produce memory leaks in applications which creates and destroy Canvas3D
//from time to time.
//Set as true if you have memory leaks after disposing Canvas3D.
//Default false value does affect Java3D View dispose behavior.
boolean forceReleaseView = false;
// Issue 480: Cache the bounds of nodes so that getBounds does not
// recompute the boounds of the entire graph per call
boolean cacheAutoComputedBounds = false;
// issue 544
boolean useBoxForGroupBounds = false;
/**
* Constructs a new MasterControl object. Note that there is
* exatly one MasterControl object, created statically by
* VirtualUniverse.
*/
MasterControl() {
assert librariesLoaded;
// Initialize the start time upon which alpha's and behaviors
// are synchronized to (if it isn't already set).
if (systemStartTime == 0L) {
systemStartTime = J3dClock.currentTimeMillis();
}
if(J3dDebug.devPhase) {
// Check to see whether debug mode is allowed
J3dDebug.debug = getBooleanProperty("j3d.debug", false,
"J3dDebug.debug");
}
// Check to see whether shared contexts are allowed
isSharedCtx = getBooleanProperty("j3d.sharedctx", isSharedCtx, "shared contexts");
doCompaction = getBooleanProperty("j3d.docompaction", doCompaction,
"compaction");
// by MIK OF CLASSX
transparentOffScreen = getBooleanProperty("j3d.transparentOffScreen", transparentOffScreen, "transparent OffScreen");
usePbuffer = getBooleanProperty("j3d.usePbuffer",
usePbuffer,
"Off-screen Pbuffer");
viewFrustumCulling = getBooleanProperty("j3d.viewFrustumCulling", viewFrustumCulling,"View frustum culling in the renderer is");
sortShape3DBounds =
getBooleanProperty("j3d.sortShape3DBounds", sortShape3DBounds,
"Shape3D bounds enabled for transparency sorting",
"Shape3D bounds *ignored* for transparency sorting");
forceReleaseView =
getBooleanProperty("j3d.forceReleaseView", forceReleaseView,
"forceReleaseView after Canvas3D dispose enabled",
"forceReleaseView after Canvas3D dispose disabled");
// FIXME: GL_NV_register_combiners
// useCombiners = getBooleanProperty("j3d.usecombiners", useCombiners,
// "Using NV_register_combiners if available",
// "NV_register_combiners disabled");
if (getProperty("j3d.disablecompile") != null) {
disableCompile = true;
System.err.println("Java 3D: BranchGroup.compile disabled");
}
if (getProperty("j3d.disableSeparateSpecular") != null) {
disableSeparateSpecularColor = true;
System.err.println("Java 3D: separate specular color disabled if possible");
}
isDisplayList = getBooleanProperty("j3d.displaylist", isDisplayList,
"display list");
implicitAntialiasing =
getBooleanProperty("j3d.implicitAntialiasing",
implicitAntialiasing,
"implicit antialiasing");
isCompiledVertexArray =
getBooleanProperty("j3d.compiledVertexArray",
isCompiledVertexArray,
"compiled vertex array");
boolean j3dOptimizeSpace =
getBooleanProperty("j3d.optimizeForSpace", true,
"optimize for space");
if (isDisplayList) {
// Build Display list for by-ref geometry
// ONLY IF optimizeForSpace is false
if (!j3dOptimizeSpace) {
buildDisplayListIfPossible = true;
}
// Build display lists for geometry with vertex attributes
// ONLY if we are in GLSL mode and GLSL shaders are available
vertexAttrsInDisplayList = true;
}
// Check to see whether Renderer can run without DSI lock
doDsiRenderLock = getBooleanProperty("j3d.renderLock",
doDsiRenderLock,
"render lock");
// Check to see whether we enforce power-of-two textures
enforcePowerOfTwo = getBooleanProperty("j3d.textureEnforcePowerOfTwo",
enforcePowerOfTwo,
"checking power-of-two textures");
// Issue 249 - check to see whether the soleUser optimization is permitted
allowSoleUser = getBooleanProperty("j3d.allowSoleUser",
allowSoleUser,
"sole-user mode");
// Issue 266 - check to see whether null graphics configs are allowed
allowNullGraphicsConfig = getBooleanProperty("j3d.allowNullGraphicsConfig",
allowNullGraphicsConfig,
"null graphics configs");
// Issue 239 - check to see whether per-frame stencil clear is enabled
stencilClear = getBooleanProperty("j3d.stencilClear",
stencilClear,
"per-frame stencil clear");
// Check to see if stereo mode is sharing the Z-buffer for both eyes.
sharedStereoZBuffer =
getBooleanProperty("j3d.sharedstereozbuffer",
sharedStereoZBuffer,
"shared stereo Z buffer");
// Get the maximum number of concurrent threads (CPUs)
final int defaultThreadLimit = getNumberOfProcessors() + 1;
Integer threadLimit = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public Integer run() {
return Integer.getInteger("j3d.threadLimit", defaultThreadLimit);
}
});
cpuLimit = threadLimit.intValue();
if (cpuLimit < 1)
cpuLimit = 1;
if (J3dDebug.debug || cpuLimit != defaultThreadLimit) {
System.err.println("Java 3D: concurrent threadLimit = " +
cpuLimit);
}
// Get the input device scheduler sampling time
Integer samplingTime = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public Integer run() {
return Integer.getInteger("j3d.deviceSampleTime", 0);
}
});
if (samplingTime.intValue() > 0) {
InputDeviceScheduler.samplingTime =
samplingTime.intValue();
System.err.println("Java 3D: Input device sampling time = "
+ samplingTime + " ms");
}
// Get the glslVertexAttrOffset
final int defaultGLSLVertexAttrOffset = glslVertexAttrOffset;
Integer vattrOffset = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public Integer run() {
return Integer.getInteger("j3d.glslVertexAttrOffset",
defaultGLSLVertexAttrOffset);
}
});
glslVertexAttrOffset = vattrOffset.intValue();
if (glslVertexAttrOffset < 1) {
glslVertexAttrOffset = 1;
}
if (J3dDebug.debug || glslVertexAttrOffset != defaultGLSLVertexAttrOffset) {
System.err.println("Java 3D: glslVertexAttrOffset = " +
glslVertexAttrOffset);
}
// Issue 480 : Cache bounds returned by getBounds()
cacheAutoComputedBounds =
getBooleanProperty("j3d.cacheAutoComputeBounds",
cacheAutoComputedBounds,
"Cache AutoCompute Bounds, accelerates getBounds()");
// Issue 544
useBoxForGroupBounds =
getBooleanProperty("j3d.useBoxForGroupBounds",
useBoxForGroupBounds,
"Use of BoundingBox for group geometric bounds");
// Check for obsolete properties
String[] obsoleteProps = {
"j3d.backgroundtexture",
"j3d.forceNormalized",
"j3d.g2ddrawpixel",
"j3d.simulatedMultiTexture",
"j3d.useFreeLists",
};
for (int i = 0; i < obsoleteProps.length; i++) {
if (getProperty(obsoleteProps[i]) != null) {
System.err.println("Java 3D: " + obsoleteProps[i] + " property ignored");
}
}
// Get the maximum Lights
maxLights = Pipeline.getPipeline().getMaximumLights();
// create the freelists
FreeListManager.createFreeLists();
// create an array canvas use registers
// The 32 limit can be lifted once the
// resourceXXXMasks in other classes
// are change not to use integer.
canvasIds = new boolean[32];
for(int i=0; i() {
@Override
public Object run() {
coreLoggerEnabled = initLogger(coreLogger, null);
devLoggerEnabled = initLogger(devLogger, Level.OFF);
statsLoggerEnabled = initLogger(statsLogger, Level.OFF);
return null;
}
});
}
/**
* Get the developer logger -- OFF by default
*
* WARNING - for probable incorrect or inconsistent api usage
* INFO - for informational messages such as performance hints (less verbose than FINE)
* FINE - for informational messages from inner loops
* FINER - using default values which may not be optimal
*/
static Logger getDevLogger() {
return devLogger;
}
static boolean isDevLoggable(Level level) {
return devLoggerEnabled && devLogger.isLoggable(level);
}
/**
* Get the stats logger -- OFF by default
*
* WARNING - statistical anomalies
* INFO - basic performance stats - not too verbose and minimally intrusive
* FINE - somewhat verbose and intrusive
* FINER - more verbose and intrusive
* FINEST - most verbose and intrusive
*/
static Logger getStatsLogger() {
return statsLogger;
}
static boolean isStatsLoggable(Level level) {
return statsLoggerEnabled && statsLogger.isLoggable(level);
}
/**
* Get the core logger -- level is INFO by default
*
* SEVERE - Serious internal errors
* WARNING - Possible internal errors or anomalies
* INFO - General informational messages
* FINE - Internal debugging information - somewhat verbose
* FINER - Internal debugging information - more verbose
* FINEST - Internal debugging information - most verbose
*/
static Logger getCoreLogger() {
return coreLogger;
}
static boolean isCoreLoggable(Level level) {
return coreLoggerEnabled && coreLogger.isLoggable(level);
}
private static String getProperty(final String prop) {
return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public String run() {
return System.getProperty(prop);
}
});
}
static int getIntegerProperty(String prop, int defaultValue) {
int value = defaultValue;
String propValue = getProperty(prop);
if (propValue != null) {
try {
value = Integer.parseInt(propValue);
}
catch (NumberFormatException e) {}
}
if (J3dDebug.debug)
System.err.println("Java 3D: " + prop + "=" + value);
return value;
}
static boolean getBooleanProperty(String prop,
boolean defaultValue,
String trueMsg,
String falseMsg) {
boolean value = defaultValue;
String propValue = getProperty(prop);
if (propValue != null) {
value = Boolean.valueOf(propValue).booleanValue();
if (J3dDebug.debug)
System.err.println("Java 3D: " + (value ? trueMsg : falseMsg));
}
return value;
}
static boolean getBooleanProperty(String prop,
boolean defaultValue,
String msg) {
return getBooleanProperty(prop,
defaultValue,
(msg + " enabled"),
(msg + " disabled"));
}
/**
* Method to create and initialize the rendering Pipeline object,
* and to load the native libraries needed by Java 3D. This is
* called by the static initializer in VirtualUniverse before
* the MasterControl object is created.
*/
static void loadLibraries() {
assert !librariesLoaded;
// Initialize the Pipeline object associated with the
// renderer specified by the "j3d.rend" system property.
//
// XXXX : We should consider adding support for a more flexible,
// dynamic selection scheme via an API call.
// Default rendering pipeline is the JOGL pipeline
Pipeline.Type pipelineType = Pipeline.Type.JOGL;
final String rendStr = getProperty("j3d.rend");
if (rendStr == null) {
// Use default pipeline
} else if (rendStr.equals("jogl")) {
pipelineType = Pipeline.Type.JOGL;
} else if (rendStr.equals("noop")) {
pipelineType = Pipeline.Type.NOOP;
} else {
System.err.println("Java 3D: Unrecognized renderer: " + rendStr);
// Use default pipeline
}
// Java 3D cannot run in headless mode unless using the noop renderer
if (java.awt.GraphicsEnvironment.isHeadless() && pipelineType != Pipeline.Type.NOOP) {
throw new java.awt.HeadlessException();
}
// Construct the singleton Pipeline instance
Pipeline.createPipeline(pipelineType);
librariesLoaded = true;
}
/**
* Invoke from InputDeviceScheduler to create an
* InputDeviceBlockingThread.
*/
InputDeviceBlockingThread getInputDeviceBlockingThread(
final InputDevice device) {
return java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public InputDeviceBlockingThread run() {
synchronized (rootThreadGroup) {
InputDeviceBlockingThread thread = new InputDeviceBlockingThread(
rootThreadGroup, device);
thread.setPriority(threadPriority);
return thread;
}
}
});
}
/**
* Set thread priority to all threads under Java3D thread group.
*/
void setThreadPriority(final int pri) {
synchronized (rootThreadGroup) {
threadPriority = pri;
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction