337 * Creates and starts a new blocker thread. Doesn't return until 338 * the new blocker thread starts. 339 * 340 * Must be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION} 341 */ 342 private void activateBlockerThread() { 343 Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, "AWT-Shutdown"); 344 thread.setContextClassLoader(null); 345 thread.setDaemon(false); 346 blockerThread = thread; 347 thread.start(); 348 try { 349 /* Wait for the blocker thread to start. */ 350 mainLock.wait(); 351 } catch (InterruptedException e) { 352 System.err.println("AWT blocker activation interrupted:"); 353 e.printStackTrace(); 354 } 355 } 356 357 final void registerPeer(final Object target, final Object peer) { 358 synchronized (activationLock) { 359 synchronized (mainLock) { 360 peerMap.put(target, peer); 361 notifyPeerMapUpdated(); 362 } 363 } 364 } 365 366 final void unregisterPeer(final Object target, final Object peer) { 367 synchronized (activationLock) { 368 synchronized (mainLock) { 369 if (peerMap.get(target) == peer) { 370 peerMap.remove(target); 371 notifyPeerMapUpdated(); 372 } 373 } 374 } 375 } 376 377 final Object getPeer(final Object target) { 378 synchronized (activationLock) { 379 synchronized (mainLock) { 380 return peerMap.get(target); 381 } 382 } 383 } 384 385 final void dumpPeers(final PlatformLogger aLog) { 386 if (aLog.isLoggable(PlatformLogger.Level.FINE)) { 387 synchronized (activationLock) { 388 synchronized (mainLock) { 389 aLog.fine("Mapped peers:"); 390 for (Object key : peerMap.keySet()) { 391 aLog.fine(key + "->" + peerMap.get(key)); 392 } 393 } 394 } 395 } 396 } 397 398 } // class AWTAutoShutdown | 337 * Creates and starts a new blocker thread. Doesn't return until 338 * the new blocker thread starts. 339 * 340 * Must be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION} 341 */ 342 private void activateBlockerThread() { 343 Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, "AWT-Shutdown"); 344 thread.setContextClassLoader(null); 345 thread.setDaemon(false); 346 blockerThread = thread; 347 thread.start(); 348 try { 349 /* Wait for the blocker thread to start. */ 350 mainLock.wait(); 351 } catch (InterruptedException e) { 352 System.err.println("AWT blocker activation interrupted:"); 353 e.printStackTrace(); 354 } 355 } 356 357 void registerPeer(final Object target, final Object peer) { 358 synchronized (activationLock) { 359 synchronized (mainLock) { 360 peerMap.put(target, peer); 361 notifyPeerMapUpdated(); 362 } 363 } 364 } 365 366 void unregisterPeer(final Object target, final Object peer) { 367 synchronized (activationLock) { 368 synchronized (mainLock) { 369 if (peerMap.get(target) == peer) { 370 peerMap.remove(target); 371 notifyPeerMapUpdated(); 372 } 373 } 374 } 375 } 376 377 Object getPeer(final Object target) { 378 synchronized (activationLock) { 379 synchronized (mainLock) { 380 return peerMap.get(target); 381 } 382 } 383 } 384 385 void dumpPeers(final PlatformLogger aLog) { 386 if (aLog.isLoggable(PlatformLogger.Level.FINE)) { 387 synchronized (activationLock) { 388 synchronized (mainLock) { 389 aLog.fine("Mapped peers:"); 390 for (Object key : peerMap.keySet()) { 391 aLog.fine(key + "->" + peerMap.get(key)); 392 } 393 } 394 } 395 } 396 } 397 398 } // class AWTAutoShutdown |