/** end the time after a method is done. */ public static void stopTimer() throws MetaException { Deadline deadline = getCurrentDeadline(); if (deadline != null) { deadline.startTime = -1; deadline.method = null; } else { throw newMetaException( new DeadlineException( "The threadlocal Deadline is null," + " please register it firstly.")); } }
/** * start the timer before a method is invoked. * * @param method */ public static void startTimer(String method) throws MetaException { Deadline deadline = getCurrentDeadline(); if (deadline != null) { deadline.startTime = System.currentTimeMillis(); deadline.method = method; } else { throw newMetaException( new DeadlineException( "The threadlocal Deadline is null," + " please register it firstly.")); } }