home *** CD-ROM | disk | FTP | other *** search
- package sun.misc;
-
- class TimerTickThread extends Thread {
- static final int MAX_POOL_SIZE = 3;
- static int curPoolSize;
- static TimerTickThread pool = null;
- TimerTickThread next;
- Timer timer;
- long lastSleepUntil;
-
- protected static synchronized TimerTickThread call(Timer var0, long var1) {
- TimerTickThread var3 = pool;
- if (var3 == null) {
- var3 = new TimerTickThread();
- var3.timer = var0;
- var3.lastSleepUntil = var1;
- ((Thread)var3).start();
- } else {
- pool = pool.next;
- var3.timer = var0;
- var3.lastSleepUntil = var1;
- synchronized(var3){}
-
- try {
- var3.notify();
- } catch (Throwable var6) {
- throw var6;
- }
- }
-
- return var3;
- }
-
- private boolean returnToPool() {
- Class var2 = this.getClass();
- synchronized(var2){}
-
- try {
- if (curPoolSize >= 3) {
- boolean var20 = false;
- return var20;
- }
-
- this.next = pool;
- pool = this;
- ++curPoolSize;
- this.timer = null;
- } catch (Throwable var19) {
- throw var19;
- }
-
- while(this.timer == null) {
- synchronized(this){}
-
- try {
- try {
- this.wait();
- } catch (InterruptedException var17) {
- }
- } catch (Throwable var18) {
- throw var18;
- }
- }
-
- Class var1 = this.getClass();
- synchronized(var1){}
-
- try {
- --curPoolSize;
- } catch (Throwable var16) {
- throw var16;
- }
-
- return true;
- }
-
- public void run() {
- do {
- this.timer.owner.tick(this.timer);
- TimerThread var1 = TimerThread.timerThread;
- synchronized(var1) {
- Timer var3 = this.timer;
- synchronized(var3){}
-
- try {
- if (this.lastSleepUntil == this.timer.sleepUntil) {
- TimerThread.requeue(this.timer);
- }
- } catch (Throwable var6) {
- throw var6;
- }
- }
- } while(this.returnToPool());
-
- }
- }
-