Class NailStats

java.lang.Object
com.martiansoftware.nailgun.NailStats
All Implemented Interfaces:
Cloneable

public class NailStats extends Object implements Cloneable

Collects and provides statistics on a nail.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Object
     
    private Class
     
    private long
     
    private long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NailStats(Class nailclass)
    Creates a new NailStats object for the specified class
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a copy of this NailStats object.
    boolean
    Returns true iff the specified NailStats object is tracking the same class.
    Returns the class for which we're tracking statistics
    long
    Returns the number of sessions currently running this nail.
    long
    Returns the number of times this nail has been run.
    int
     
    (package private) void
    Logs the fact that an instance of this nail has finished
    (package private) void
    Logs the fact that an instance of this nail has started
    Returns a String representation of this NailStats object, in the form "classname: runcount/refcount".

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • nailclass

      private Class nailclass
    • runCounter

      private long runCounter
    • refCounter

      private long refCounter
    • lock

      private Object lock
  • Constructor Details

    • NailStats

      NailStats(Class nailclass)
      Creates a new NailStats object for the specified class
      Parameters:
      nailclass - the class for which we'll collect statistics
  • Method Details

    • 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 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 class Object
      See Also:
    • equals

      public boolean equals(Object o)
      Returns true iff the specified NailStats object is tracking the same class.
      Overrides:
      equals in class Object
      Parameters:
      o - the NailStats object to check
      Returns:
      true iff the specified NailStats object is tracking the same class.
    • clone

      public Object clone()
      Creates a copy of this NailStats object.
      Overrides:
      clone in class Object
      Returns:
      a copy of this NailStats object.
    • toString

      public String toString()
      Returns a String representation of this NailStats object, in the form "classname: runcount/refcount". *return a String representation of this NailStats object.
      Overrides:
      toString in class Object