org.apache.jetspeed.statistics.impl
Class BatchedStatistics

java.lang.Object
  extended by org.apache.jetspeed.statistics.impl.BatchedStatistics
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
BatchedPageStatistics, BatchedPortletStatistics, BatchedUserStatistics

public abstract class BatchedStatistics
extends Object
implements Runnable

BatchedStatistics

Version:
$Id: TestPortletEntityDAO.java,v 1.3 2005/05/24 14:43:19 ate Exp $
Author:
Chris Schaefer , David Sean Taylor

Field Summary
protected  int batchSize
           
private  boolean done
           
protected  DataSource ds
           
private  boolean keepRunning
           
protected  List logRecords
           
protected  long msElapsedTimeThreshold
           
protected  long msLastFlushTime
           
protected  String name
           
protected  Thread thread
           
 
Constructor Summary
BatchedStatistics(DataSource ds, int batchSize, long msElapsedTimeThreshold, String name)
           
 
Method Summary
 void addStatistic(LogRecord logRecord)
           
abstract  boolean canDoRecordType(LogRecord rec)
           
private  void checkAndDoFlush()
          should only be called from code synchronized to the linked list
 void flush()
           
protected  Connection getConnection()
           
protected abstract  PreparedStatement getPreparedStatement(Connection con)
           
 boolean isDone()
           
protected abstract  void loadOneRecordToStatement(PreparedStatement stm, LogRecord rec)
           
(package private)  void releaseConnection(Connection con)
           
 void run()
           
 void startThread()
           
 void tellThreadToStop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

done

private boolean done

keepRunning

private boolean keepRunning

thread

protected Thread thread

msLastFlushTime

protected long msLastFlushTime

batchSize

protected int batchSize

msElapsedTimeThreshold

protected long msElapsedTimeThreshold

logRecords

protected List logRecords

ds

protected DataSource ds

name

protected String name
Constructor Detail

BatchedStatistics

public BatchedStatistics(DataSource ds,
                         int batchSize,
                         long msElapsedTimeThreshold,
                         String name)
Method Detail

startThread

public void startThread()

getConnection

protected Connection getConnection()
                            throws SQLException
Throws:
SQLException

checkAndDoFlush

private void checkAndDoFlush()
should only be called from code synchronized to the linked list


addStatistic

public void addStatistic(LogRecord logRecord)

isDone

public boolean isDone()

tellThreadToStop

public void tellThreadToStop()

run

public void run()
Specified by:
run in interface Runnable

flush

public void flush()

getPreparedStatement

protected abstract PreparedStatement getPreparedStatement(Connection con)
                                                   throws SQLException
Throws:
SQLException

loadOneRecordToStatement

protected abstract void loadOneRecordToStatement(PreparedStatement stm,
                                                 LogRecord rec)
                                          throws SQLException
Throws:
SQLException

releaseConnection

void releaseConnection(Connection con)

canDoRecordType

public abstract boolean canDoRecordType(LogRecord rec)


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.