com.neeve.stats
Class StatsRegistry

java.lang.Object
  extended by com.neeve.stats.StatsRegistry

public final class StatsRegistry
extends Object

Stores operating statistics objects in a Neeve application.

The statistics registry is a singleton class that stores statistics objects for operating entities in a Neeve application. Objects stored in the registry are of type IStats. Neeve classes store statistical information in class specific statistics classes that implement interfaces derived from IStats. This registry stores such running instances of these statistics classes. As specified by the IStats, each statistics object is uniquely identified by a name which serves as the key using which the statistics object is stored in the registry. The statistics object is added to the registry when first created and removed when closed. The entity whose statistics are contained in the statistics object defines when the object is created and closed.

The purpose of the statistics registry is to enable a user to query a statistics object by name and get information from the object or start and stop the periodic output of the contained statistical information in a human readble string format. For example, in case the user is interested in statistical information exported by a network link, the user would use the name assigned to the statistical object for the specific network link and query the registry for the object by the name. The user can then cast the obtained statistics object to the statistics interface specific to the network link and interact with the casted object.

Threading:
This class is safe for concurrent access by multiple threads.

Method Summary
 IStats get(String name)
          Get a statistics object from the registry.
static String getFullyQualifiedName(IStats stats)
          Prepare the fully qualified name of a statistics object.
static StatsRegistry getInstance()
          Return the singleton statistics registry instance
 cern.colt.list.ObjectArrayList getValues()
          Return a list of statistics objects in the registry.
 void put(IStats stats)
          Put a statistics object into the registry.
 IStats remove(IStats stats)
          Remove a statistics object from the registry.
 IStats remove(String name)
          Remove a statistics object from the registry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static StatsRegistry getInstance()
Return the singleton statistics registry instance

Returns:
Returns the statistics registry
Threading:
This method is safe for concurrent access by multiple threads

getFullyQualifiedName

public static String getFullyQualifiedName(IStats stats)
Prepare the fully qualified name of a statistics object.

Parameters:
stats - The object whose name is to be prepared.

This method prepares the fully qualified name of a statistics object. A fully qualified name is of the form

'..stats'

The fully qualified name of a statistics object is used as its key in the registry.

Threading:
This method is safe for concurrent access by multiple threads

put

public final void put(IStats stats)
               throws EStatsAlreadyPresentException
Put a statistics object into the registry.

Parameters:
stats - The statistics object to insert into the registry.
Throws:
EStatsAlreadyPresentException - Indicates that an object by the statistics objects name is already present in the registry.

This method is intended for use by entities publicizing their statistics objects. This method adds the provided statistics object to the registry keyed by the fully qualfied name of the statistics object.

See Also:
getFullyQualifiedName(com.neeve.stats.IStats)
Threading:
This method is safe for concurrent access by multiple threads

get

public final IStats get(String name)
Get a statistics object from the registry.

Parameters:
name - The name used to identify the statistics object.

This method uses the supplied name to lookup a statistics object in the registry. A null value is returned in case no objectcould not be found for the specified name.

Threading:
This method is safe for concurrent access by multiple threads

getValues

public final cern.colt.list.ObjectArrayList getValues()
Return a list of statistics objects in the registry.

Returns:
Returns the list of statistics objects in the registry.

This method returns a copy of the list of statistics objects in the registry. The user is free to modify the returned list concurrently with updating the registry.

Threading:
This method is safe for concurrent access by multiple threads

remove

public final IStats remove(IStats stats)
Remove a statistics object from the registry.

Parameters:
stats - The stats object to remove.
Returns:
Returns the object removed from the registry

This method uses the supplied name to remove a statistics object from the registry. A null value is returned in case no object with the specified name could be found.

Threading:
This method is safe for concurrent access by multiple threads

remove

public final IStats remove(String name)
Remove a statistics object from the registry.

Parameters:
name - The fully qualified name of the stats object to remove.
Returns:
Returns the object removed from the registry

This method uses the supplied name to remove a statistics object from the registry. A null value is returned in case no object with the specified name could be found.

Threading:
This method is safe for concurrent access by multiple threads


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.