本文整理汇总了Java中sun.misc.ThreadGroupUtils类的典型用法代码示例。如果您正苦于以下问题:Java ThreadGroupUtils类的具体用法?Java ThreadGroupUtils怎么用?Java ThreadGroupUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThreadGroupUtils类属于sun.misc包,在下文中一共展示了ThreadGroupUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
static void init() {
if (t == null) {
// Add a shutdown hook to remove the temp file.
AccessController.doPrivileged(
(PrivilegedAction<Void>) () -> {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
* Make its parent the top-level thread group.
*/
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
t = new Thread(rootTG, TempFileDeletionHook::runHooks);
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
});
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:CreatedFontTracker.java
示例2: init
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
protected final void init() {
AWTAutoShutdown.notifyToolkitThreadBusy();
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
Runtime.getRuntime().addShutdownHook(
new Thread(rootTG, () -> {
shutdown();
waitForRunState(STATE_CLEANUP);
})
);
Thread toolkitThread = new Thread(rootTG, this, "AWT-LW");
toolkitThread.setDaemon(true);
toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
toolkitThread.start();
waitForRunState(STATE_MESSAGELOOP);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:LWToolkit.java
示例3: D3DScreenUpdateManager
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
public D3DScreenUpdateManager() {
done = false;
AccessController.doPrivileged(
(PrivilegedAction<Void>) () -> {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Thread shutdown = new Thread(rootTG, () -> {
done = true;
wakeUpUpdateThread();
});
shutdown.setContextClassLoader(null);
try {
Runtime.getRuntime().addShutdownHook(shutdown);
} catch (Exception e) {
done = true;
}
return null;
}
);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:D3DScreenUpdateManager.java
示例4: startUpdateThread
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
/**
* If the update thread hasn't yet been created, it will be;
* otherwise it is awaken
*/
private synchronized void startUpdateThread() {
if (screenUpdater == null) {
screenUpdater = AccessController.doPrivileged(
(PrivilegedAction<Thread>) () -> {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Thread t = new Thread(rootTG,
D3DScreenUpdateManager.this,
"D3D Screen Updater");
// REMIND: should it be higher?
t.setPriority(Thread.NORM_PRIORITY + 2);
t.setDaemon(true);
return t;
});
screenUpdater.start();
} else {
wakeUpUpdateThread();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:D3DScreenUpdateManager.java
示例5: newThread
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
public synchronized Thread newThread(final Runnable task) {
final Runnable comRun = new Runnable() {
public void run() {
try {
initializeCom();
task.run();
} finally {
uninitializeCom();
}
}
};
comThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
* Make its parent the top-level thread group.
*/
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Thread thread = new Thread(rootTG, comRun, "Swing-Shell");
thread.setDaemon(true);
return thread;
}
);
return comThread;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Win32ShellFolderManager2.java
示例6: init
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
static void init() {
if (t == null) {
// Add a shutdown hook to remove the temp file.
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
/* The thread must be a member of a thread group
* which will not get GCed before VM exit.
* Make its parent the top-level thread group.
*/
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
t = new Thread(rootTG, new Runnable() {
@Override
public void run() {
runHooks();
}
});
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
}
});
}
}
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:25,代码来源:CreatedFontTracker.java
示例7: D3DScreenUpdateManager
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
public D3DScreenUpdateManager() {
done = false;
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
@Override
public Void run() {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Thread shutdown = new Thread(rootTG, new Runnable() {
@Override
public void run() {
done = true;
wakeUpUpdateThread();
}
});
shutdown.setContextClassLoader(null);
try {
Runtime.getRuntime().addShutdownHook(shutdown);
} catch (Exception e) {
done = true;
}
return null;
}
}
);
}
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:26,代码来源:D3DScreenUpdateManager.java
示例8: startUpdateThread
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
/**
* If the update thread hasn't yet been created, it will be;
* otherwise it is awaken
*/
private synchronized void startUpdateThread() {
if (screenUpdater == null) {
screenUpdater = AccessController.doPrivileged(
new PrivilegedAction<Thread>() {
@Override
public Thread run() {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Thread t = new Thread(rootTG,
D3DScreenUpdateManager.this,
"D3D Screen Updater");
// REMIND: should it be higher?
t.setPriority(Thread.NORM_PRIORITY + 2);
t.setDaemon(true);
return t;
}
});
screenUpdater.start();
} else {
wakeUpUpdateThread();
}
}
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:26,代码来源:D3DScreenUpdateManager.java
示例9: OGLRenderQueue
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
private OGLRenderQueue() {
/*
* The thread must be a member of a thread group
* which will not get GCed before VM exit.
*/
flusher = AccessController.doPrivileged((PrivilegedAction<QueueFlusher>) () -> {
return new QueueFlusher(ThreadGroupUtils.getRootThreadGroup());
});
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:OGLRenderQueue.java
示例10: activateBlockerThread
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
/**
* Creates and starts a new blocker thread. Doesn't return until
* the new blocker thread starts.
*
* Must be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
*/
private void activateBlockerThread() {
Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, "AWT-Shutdown");
thread.setContextClassLoader(null);
thread.setDaemon(false);
blockerThread = thread;
thread.start();
try {
/* Wait for the blocker thread to start. */
mainLock.wait();
} catch (InterruptedException e) {
System.err.println("AWT blocker activation interrupted:");
e.printStackTrace();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AWTAutoShutdown.java
示例11: registerShutdownHook
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
private final void registerShutdownHook() {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
Thread shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
shutdown.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(shutdown);
return null;
});
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:WToolkit.java
示例12: setDisplayMode
import sun.misc.ThreadGroupUtils; //导入依赖的package包/类
@Override
public synchronized void setDisplayMode(DisplayMode dm) {
if (!isDisplayChangeSupported()) {
super.setDisplayMode(dm);
return;
}
Window w = getFullScreenWindow();
if (w == null) {
throw new IllegalStateException("Must be in fullscreen mode " +
"in order to set display mode");
}
if (getDisplayMode().equals(dm)) {
return;
}
if (dm == null ||
(dm = getMatchingDisplayMode(dm)) == null)
{
throw new IllegalArgumentException("Invalid display mode");
}
if (!shutdownHookRegistered) {
// register a shutdown hook so that we return to the
// original DisplayMode when the VM exits (if the application
// is already in the original DisplayMode at that time, this
// hook will have no effect)
shutdownHookRegistered = true;
PrivilegedAction<Void> a = () -> {
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
Runnable r = () -> {
Window old = getFullScreenWindow();
if (old != null) {
exitFullScreenExclusive(old);
setDisplayMode(origDisplayMode);
}
};
Thread t = new Thread(rootTG, r,"Display-Change-Shutdown-Thread-"+screen);
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
};
AccessController.doPrivileged(a);
}
// switch to the new DisplayMode
configDisplayMode(screen,
dm.getWidth(), dm.getHeight(),
dm.getRefreshRate());
// update bounds of the fullscreen window
w.setBounds(0, 0, dm.getWidth(), dm.getHeight());
// configDisplayMode() is synchronous, so the display change will be
// complete by the time we get here (and it is therefore safe to call
// displayChanged() now)
((X11GraphicsEnvironment)
GraphicsEnvironment.getLocalGraphicsEnvironment()).displayChanged();
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:X11GraphicsDevice.java
注:本文中的sun.misc.ThreadGroupUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论