to.etc.dbpool.info
Class PerformanceStore

java.lang.Object
  extended by to.etc.dbpool.info.PerformanceStore
Direct Known Subclasses:
PerformanceCollector

public class PerformanceStore
extends java.lang.Object

Generic metrics storage class; base class both the per-thread metrics storage plus the per-session and per-startup stores. This class allows storage of multiple "top xxx" lists, where every list stores a descending or ascending set of metrics - by some numeric value. This creates a top-nnn of things, like:

Every specific top-xxx list has it's own max size, ascending/descending indication and is identified by some string key value.

In every toplist, each "item" contains the following data:

None of the methods of this base class are threadsafe; code using this must take care of that itself.

Author:
Frits Jalvingh Created on Nov 8, 2010

Constructor Summary
PerformanceStore()
           
 
Method Summary
 void addItem(java.lang.String listKey, PerfItem pi)
           
 void addItem(java.lang.String listKey, java.lang.String itemKey, long value, java.lang.String request, java.lang.Object data)
          Add an item to the specified list if it is is within that lists's bounds.
 void clear()
           
 void define(java.lang.String key, java.lang.String desc, boolean descending, int maxsize)
           
 java.util.List<PerfItem> getItems(java.lang.String listKey)
           
 PerfList getList(java.lang.String key)
           
 java.util.List<PerfList> getLists()
           
 void merge(PerformanceStore other)
          This merges-in the performance data from another store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerformanceStore

public PerformanceStore()
Method Detail

define

public void define(java.lang.String key,
                   java.lang.String desc,
                   boolean descending,
                   int maxsize)

getList

@Nonnull
public final PerfList getList(java.lang.String key)

getLists

public final java.util.List<PerfList> getLists()

getItems

public final java.util.List<PerfItem> getItems(java.lang.String listKey)

addItem

public void addItem(@Nonnull
                    java.lang.String listKey,
                    @Nonnull
                    java.lang.String itemKey,
                    long value,
                    @Nullable
                    java.lang.String request,
                    @Nullable
                    java.lang.Object data)
Add an item to the specified list if it is is within that lists's bounds.

Parameters:
listKey -
itemKey -
value -
data -

addItem

public void addItem(@Nonnull
                    java.lang.String listKey,
                    @Nonnull
                    PerfItem pi)

merge

public void merge(PerformanceStore other)
This merges-in the performance data from another store. For every list it merges the items of the other list inside this one. If a list in the other type is unknown here it's definition is copied, else the existing definition in here takes precedence. The developer should take care that merged lists should have the same data definition.

Parameters:
other -

clear

public void clear()