view src/org/dancres/blitz/txn/TxnStatGenerator.java @ 23:b7e52953b7a6

Add some cache/memory statistics to help spot potential exhaustion and other tuning issues.
author Dan Creswell <dan.creswell@gmail.com>
date Fri, 28 Aug 2009 17:23:33 +0100
parents 3dc0c5604566
children
line wrap: on
line source

package org.dancres.blitz.txn;

import org.dancres.blitz.stats.TxnStat;
import org.dancres.blitz.stats.Stat;
import org.dancres.blitz.stats.StatGenerator;

/**
   Registered with the StatsBoard to generate statistics for transaction
   state.

   @see org.dancres.blitz.stats.TxnStat
 */
public class TxnStatGenerator implements StatGenerator {
    private long theId = StatGenerator.UNSET_ID;

    TxnStatGenerator() {
    }

    public void setId(long anId) {
        theId = anId;
    }

    public long getId() {
        return theId;
    }

    public synchronized Stat generate() {
        TxnStat myStat = new TxnStat(theId,
                                     TxnManager.get().getActiveTxnCount());

        return myStat;
    }
}