src/share/classes/sun/awt/AWTAutoShutdown.java
Print this page
@@ -24,14 +24,17 @@
*/
package sun.awt;
import java.awt.AWTEvent;
+
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Map;
+import java.util.Set;
+
import sun.util.logging.PlatformLogger;
/**
* This class is to let AWT shutdown automatically when a user is done
* with AWT. It tracks AWT state using the following parameters:
@@ -79,11 +82,11 @@
* This set keeps references to all the event dispatch threads that
* are busy at this moment, i.e. those that are not waiting for a
* new event to appear in their event queue.
* Access is synchronized on the main lock object.
*/
- private final HashSet busyThreadSet = new HashSet(7);
+ private final Set<Thread> busyThreadSet = new HashSet<>(7);
/**
* Indicates whether the toolkit thread is waiting for a new native
* event to appear or is dispatching an event.
*/
@@ -91,11 +94,11 @@
/**
* This is a map between components and their peers.
* we should work with in under activationLock&mainLock lock.
*/
- private final Map peerMap = new IdentityHashMap();
+ private final Map<Object, Object> peerMap = new IdentityHashMap<>();
/**
* References the alive non-daemon thread that is currently used
* for keeping AWT from exiting.
*/
@@ -317,12 +320,14 @@
if (!interrupted) {
AppContext.stopEventDispatchThreads();
}
}
+ @SuppressWarnings("serial")
static AWTEvent getShutdownEvent() {
- return new AWTEvent(getInstance(), 0) {};
+ return new AWTEvent(getInstance(), 0) {
+ };
}
/**
* Creates and starts a new blocker thread. Doesn't return until
* the new blocker thread starts.