1 17 18 package org.apache.geronimo.transaction.manager; 19 20 25 public class TransactionTimer { 26 private static volatile long currentTime; 27 28 private static class CurrentTime extends Thread { 29 protected CurrentTime() { 30 currentTime = System.currentTimeMillis(); 31 setContextClassLoader(null); 32 } 33 34 public void run() { 35 for (; ;) { 36 currentTime = System.currentTimeMillis(); 37 try { 38 Thread.sleep(1000); 39 } catch (InterruptedException e) { 40 } 42 } 43 } 44 } 45 46 static { 47 CurrentTime tm = new CurrentTime(); 48 tm.setDaemon(true); 49 tm.start(); 50 } 51 52 public static long getCurrentTime() { 53 return currentTime; 54 } 55 56 } 57 | Popular Tags |