1 4 package com.tc.util; 5 6 import EDU.oswego.cs.dl.util.concurrent.Latch; 7 8 import java.util.Timer ; 9 import java.util.TimerTask ; 10 11 15 public class TCTimerImpl extends Timer implements TCTimer { 16 17 public TCTimerImpl(final String threadName, boolean isDaemon) { 19 super(isDaemon); 20 21 final Latch proceed = new Latch(); 22 23 TimerTask nameSetter = new TimerTask () { 24 public void run() { 25 Thread.currentThread().setName(threadName); 26 proceed.release(); 27 } 28 }; 29 30 schedule(nameSetter, 0L); 31 32 try { 33 proceed.acquire(); 34 } catch (InterruptedException e) { 35 } 37 } 38 39 } 40 | Popular Tags |