Package com.martiansoftware.nailgun
Class NailStats
- java.lang.Object
-
- com.martiansoftware.nailgun.NailStats
-
- All Implemented Interfaces:
java.lang.Cloneable
public class NailStats extends java.lang.Object implements java.lang.Cloneable
Collects and provides statistics on a nail.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
lock
private java.lang.Class
nailclass
private long
refCounter
private long
runCounter
-
Constructor Summary
Constructors Constructor Description NailStats(java.lang.Class nailclass)
Creates a new NailStats object for the specified class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Creates a copy of thisNailStats
object.boolean
equals(java.lang.Object o)
Returns true iff the specifiedNailStats
object is tracking the same class.java.lang.Class
getNailClass()
Returns the class for which we're tracking statisticslong
getRefCount()
Returns the number of sessions currently running this nail.long
getRunCount()
Returns the number of times this nail has been run.int
hashCode()
(package private) void
nailFinished()
Logs the fact that an instance of this nail has finished(package private) void
nailStarted()
Logs the fact that an instance of this nail has startedjava.lang.String
toString()
Returns a String representation of thisNailStats
object, in the form "classname: runcount/refcount".
-
-
-
Method Detail
-
nailStarted
void nailStarted()
Logs the fact that an instance of this nail has started
-
nailFinished
void nailFinished()
Logs the fact that an instance of this nail has finished
-
getRunCount
public long getRunCount()
Returns the number of times this nail has been run. Nails that have started but not yet finished are included in this number.- Returns:
- the number of times this nail has been run.
-
getRefCount
public long getRefCount()
Returns the number of sessions currently running this nail.- Returns:
- the number of sessions currently running this nail.
-
getNailClass
public java.lang.Class getNailClass()
Returns the class for which we're tracking statistics- Returns:
- the class for which we're tracking statistics
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
equals
public boolean equals(java.lang.Object o)
Returns true iff the specifiedNailStats
object is tracking the same class.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the NailStats object to check- Returns:
- true iff the specified
NailStats
object is tracking the same class.
-
clone
public java.lang.Object clone()
Creates a copy of thisNailStats
object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- a copy of this
NailStats
object.
-
toString
public java.lang.String toString()
Returns a String representation of thisNailStats
object, in the form "classname: runcount/refcount". *return a String representation of thisNailStats
object.- Overrides:
toString
in classjava.lang.Object
-
-