public class Duration extends Object implements Closeable
| Constructor and Description |
|---|
Duration()
Create a duration instance with a limit of 0
|
Duration(long limit)
Create a duration with a limit specified in millis
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
The close operation relays to
finish(). |
void |
finish() |
long |
getInterval() |
boolean |
getLimitExceeded()
return true if the limit has been exceeded
|
protected long |
now() |
Duration |
start()
Start
|
String |
toString() |
public Duration()
public Duration(long limit)
limit - duration in millisecondspublic Duration start()
public final void close()
finish().
Implementing it allows Duration instances to be automatically
finish()'d in Java7 try blocks for when used in measuring durations.close in interface Closeableclose in interface AutoCloseablepublic void finish()
protected long now()
public long getInterval()
public boolean getLimitExceeded()
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.