org.multiverse.utils.profiling
Class SimpleProfileRepository

java.lang.Object
  extended by org.multiverse.utils.profiling.SimpleProfileRepository
All Implemented Interfaces:
ProfileRepository

public final class SimpleProfileRepository
extends java.lang.Object
implements ProfileRepository

A simple ProfileRepository implementation.

Improvements needed:

  1. composedkey is created even for lookup. Object creation is slow so this unwanted object creation should be removed
  2. The ConcurrentHashMap still needs locking (even though it used striped locks), so perhaps a non blocking version could improve performance

Author:
Peter Veentjer.

Constructor Summary
SimpleProfileRepository()
           
 
Method Summary
 void decCounter(java.lang.String familyName, java.lang.String key2)
           
 ProfileCollator getCollator()
          TODO: the methods of ProfileCollator should probably simply be part of the ProfileRepository contract.
 long getCount(java.lang.String key)
          Returns the count for some key.
 long getCount(java.lang.String key1, java.lang.String key2)
           
 java.util.Iterator<java.lang.String> getKey1Iterator()
           
 void incCounter(java.lang.String key)
           
 void incCounter(java.lang.String key, int amount)
           
 void incCounter(java.lang.String key1, java.lang.String key2)
           
 void incCounter(java.lang.String key1, java.lang.String key2, long count)
           
 void reset()
           
 long sumKey1(java.lang.String key1)
           
 long sumKey2(java.lang.String key2)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleProfileRepository

public SimpleProfileRepository()
Method Detail

incCounter

public void incCounter(java.lang.String key)
Specified by:
incCounter in interface ProfileRepository

incCounter

public void incCounter(java.lang.String key,
                       int amount)
Specified by:
incCounter in interface ProfileRepository

getCount

public long getCount(java.lang.String key)
Description copied from interface: ProfileRepository
Returns the count for some key.

Specified by:
getCount in interface ProfileRepository
Parameters:
key - the key
Returns:
the count, or -1 if no key was found.

reset

public void reset()
Specified by:
reset in interface ProfileRepository

incCounter

public void incCounter(java.lang.String key1,
                       java.lang.String key2)
Specified by:
incCounter in interface ProfileRepository

incCounter

public void incCounter(java.lang.String key1,
                       java.lang.String key2,
                       long count)
Specified by:
incCounter in interface ProfileRepository

getKey1Iterator

public java.util.Iterator<java.lang.String> getKey1Iterator()
Specified by:
getKey1Iterator in interface ProfileRepository

getCount

public long getCount(java.lang.String key1,
                     java.lang.String key2)
Specified by:
getCount in interface ProfileRepository

decCounter

public void decCounter(java.lang.String familyName,
                       java.lang.String key2)
Specified by:
decCounter in interface ProfileRepository

sumKey2

public long sumKey2(java.lang.String key2)
Specified by:
sumKey2 in interface ProfileRepository

sumKey1

public long sumKey1(java.lang.String key1)
Specified by:
sumKey1 in interface ProfileRepository

getCollator

public ProfileCollator getCollator()
Description copied from interface: ProfileRepository
TODO: the methods of ProfileCollator should probably simply be part of the ProfileRepository contract.

Specified by:
getCollator in interface ProfileRepository
Returns:
a collator for this repository

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 Multiverse. All Rights Reserved.