org.jdesktop.wonderland.client.cell
Class CellStatistics

java.lang.Object
  extended by org.jdesktop.wonderland.client.cell.CellStatistics

public class CellStatistics
extends java.lang.Object

Stores statistics about the cells in a given cell cache.

Cell performance statistics are not shared between clients, they are particular to the Wonderland instance on a given client.

This interface is simply an entry point for collecting statistics. The actual work of collecting the statistics and processing them is handled by a provider that implements the CellStatisticsSPI interface. The provider can be set using the setProvider() method.

Author:
Jonathan Kaplan

Nested Class Summary
static class CellStatistics.CellStat
          The base class for cell statistics.
static interface CellStatistics.CellStatisticsSPI
          Interface implemented by statistic providers.
static class CellStatistics.LongCellStat
          A mutable statistic that returns a long as its value
static class CellStatistics.SizeCellStat
          A statistic representing a size in bytes.
static class CellStatistics.StringCellStat
          A statistic that records a string as its value
static class CellStatistics.TimeCellStat
          A statistic that stores time values.
 
Constructor Summary
CellStatistics()
           
 
Method Summary
 void add(Cell cell, CellStatistics.CellStat stat)
          Add the given statistic to the given cell, replacing it if it already exists.
 CellStatistics.CellStat get(Cell cell, java.lang.String id)
          Get a statistic from the given cell
 java.util.Collection<CellStatistics.CellStat> getAll(Cell cell)
          Get all statistics from the given cell.
 CellStatistics.CellStatisticsSPI getProvider()
          Get the current provider
 CellStatistics.CellStat remove(Cell cell, java.lang.String id)
          Remove a statistic from the given cell.
 void setProvider(CellStatistics.CellStatisticsSPI provider)
          Set the provider that will collect statistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellStatistics

public CellStatistics()
Method Detail

setProvider

public void setProvider(CellStatistics.CellStatisticsSPI provider)
Set the provider that will collect statistics

Parameters:
provider - the provider to set

getProvider

public CellStatistics.CellStatisticsSPI getProvider()
Get the current provider

Returns:
the current provider

add

public void add(Cell cell,
                CellStatistics.CellStat stat)
Add the given statistic to the given cell, replacing it if it already exists.

Parameters:
cell - the cell to add a statistic to
stat - the statistic to add

get

public CellStatistics.CellStat get(Cell cell,
                                   java.lang.String id)
Get a statistic from the given cell

Parameters:
cell - the cell to get a statistic from
id - the id of the statistic to get
Returns:
the statistic from the given cell with the given id, or null if the cell does not have a statistic with the given id

getAll

public java.util.Collection<CellStatistics.CellStat> getAll(Cell cell)
Get all statistics from the given cell. The returned collection will be a copy of the actual data, so changes to the result will not change the underlying statistics.

Parameters:
cell - the cell to get all statistics from
Returns:
a collection of cell statistics for the given cell

remove

public CellStatistics.CellStat remove(Cell cell,
                                      java.lang.String id)
Remove a statistic from the given cell.

Parameters:
cell - the cell to remove a statistic from
id - the id of the statistic to remove
Returns:
the removed statistic, or null if no statistic with the given id was found


Open Wonderland - http://openwonderland.org