1 Clazz.declarePackage ("jssun.awt");
\r
2 Clazz.load (["java.util.HashSet", "$.IdentityHashMap"], "jssun.awt.AWTAutoShutdown", ["java.awt.AWTEvent"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
4 this.busyThreadSet = null;
\r
5 this.toolkitThreadBusy = false;
\r
7 Clazz.instantialize (this, arguments);
\r
8 }, jssun.awt, "AWTAutoShutdown", null, Runnable);
\r
9 Clazz.prepareFields (c$, function () {
\r
10 this.busyThreadSet = new java.util.HashSet (7);
\r
11 this.peerMap = new java.util.IdentityHashMap ();
\r
13 Clazz.makeConstructor (c$,
\r
16 c$.getInstance = Clazz.defineMethod (c$, "getInstance",
\r
18 return (jssun.awt.AWTAutoShutdown.theInstance == null ? (jssun.awt.AWTAutoShutdown.theInstance = new jssun.awt.AWTAutoShutdown ()) : jssun.awt.AWTAutoShutdown.theInstance);
\r
20 c$.notifyToolkitThreadBusy = Clazz.defineMethod (c$, "notifyToolkitThreadBusy",
\r
22 jssun.awt.AWTAutoShutdown.getInstance ().setToolkitBusy (true);
\r
24 c$.notifyToolkitThreadFree = Clazz.defineMethod (c$, "notifyToolkitThreadFree",
\r
26 jssun.awt.AWTAutoShutdown.getInstance ().setToolkitBusy (false);
\r
28 Clazz.defineMethod (c$, "notifyThreadBusy",
\r
30 this.busyThreadSet.add (thread);
\r
32 Clazz.defineMethod (c$, "notifyThreadFree",
\r
34 this.busyThreadSet.remove (thread);
\r
36 Clazz.defineMethod (c$, "notifyPeerMapUpdated",
\r
38 if (!this.isReadyToShutdown ()) {
\r
39 this.activateBlockerThread ();
\r
41 Clazz.defineMethod (c$, "isReadyToShutdown",
\r
43 return (!this.toolkitThreadBusy && this.peerMap.isEmpty () && this.busyThreadSet.isEmpty ());
\r
45 Clazz.defineMethod (c$, "setToolkitBusy",
\r
47 if (busy != this.toolkitThreadBusy) {
\r
48 if (busy != this.toolkitThreadBusy) {
\r
50 this.toolkitThreadBusy = busy;
\r
52 this.toolkitThreadBusy = busy;
\r
54 Clazz.overrideMethod (c$, "run",
\r
57 c$.getShutdownEvent = Clazz.defineMethod (c$, "getShutdownEvent",
\r
59 return ((Clazz.isClassDefined ("jssun.awt.AWTAutoShutdown$1") ? 0 : jssun.awt.AWTAutoShutdown.$AWTAutoShutdown$1$ ()), Clazz.innerTypeInstance (jssun.awt.AWTAutoShutdown$1, this, null, jssun.awt.AWTAutoShutdown.getInstance (), 0));
\r
61 Clazz.defineMethod (c$, "activateBlockerThread",
\r
64 Clazz.defineMethod (c$, "registerPeer",
\r
65 function (target, peer) {
\r
66 this.peerMap.put (target, peer);
\r
67 this.notifyPeerMapUpdated ();
\r
69 Clazz.defineMethod (c$, "unregisterPeer",
\r
70 function (target, peer) {
\r
71 if (this.peerMap.get (target) === peer) {
\r
72 this.peerMap.remove (target);
\r
74 Clazz.defineMethod (c$, "getPeer",
\r
76 return this.peerMap.get (target);
\r
78 Clazz.defineMethod (c$, "dumpPeers",
\r
80 aLog.fine ("Mapped peers:");
\r
81 for (var key, $key = this.peerMap.keySet ().iterator (); $key.hasNext () && ((key = $key.next ()) || true);) {
\r
82 aLog.fine (key + "->" + this.peerMap.get (key));
\r
84 }, "java.util.logging.Logger");
\r
85 c$.$AWTAutoShutdown$1$ = function () {
\r
86 Clazz.pu$h(self.c$);
\r
87 c$ = Clazz.declareAnonymous (jssun.awt, "AWTAutoShutdown$1", java.awt.AWTEvent);
\r
90 Clazz.defineStatics (c$,
\r
91 "theInstance", null);
\r