org.starhope.appius.util
Class DataRecordFlushManager

java.lang.Object
  extended by org.starhope.appius.util.DataRecordFlushManager

public class DataRecordFlushManager
extends Object

This is a static singleton class which performs a number of useful functions for suppressing excessive I/O writes to the backing store for rapidly- changing data records

Author:
brpocock@star-hope.org

Field Summary
private static DataRecordFlushThread flushThread
          WRITEME
static Set<DataRecord> pendingRecords
          records pending a flush to backing store
 
Constructor Summary
DataRecordFlushManager()
           
 
Method Summary
static int flush(int count)
          Flush a few records, then return how many remain
(package private) static
<T extends DataRecord>
void
flush(T r)
          Flush a record to the database
static void flushAll()
          Flush all records for shutdown
private static
<T extends DataRecord>
void
flushLater(T record)
          If the Background Flush thread is not already running, make sure that it will run
static
<T extends DataRecord>
void
update(RecordLoader<T> recordLoader, T record)
          Decide whether to update the saved copy of a changed record based upon its current change time and modification time, and whether there are remote listeners who are interested in receiving notifications of changes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flushThread

private static DataRecordFlushThread flushThread
WRITEME


pendingRecords

public static final Set<DataRecord> pendingRecords
records pending a flush to backing store

Constructor Detail

DataRecordFlushManager

public DataRecordFlushManager()
Method Detail

flush

public static int flush(int count)
Flush a few records, then return how many remain

Parameters:
count - the number of records to flush
Returns:
how many remain

flush

static <T extends DataRecord> void flush(T r)
Flush a record to the database

Type Parameters:
T - the record type
Parameters:
r - the record to be flushed

flushAll

public static void flushAll()
Flush all records for shutdown


flushLater

private static <T extends DataRecord> void flushLater(T record)
If the Background Flush thread is not already running, make sure that it will run

Type Parameters:
T - WRITEME
Parameters:
record - WRITEME

update

public static <T extends DataRecord> void update(RecordLoader<T> recordLoader,
                                                 T record)
Decide whether to update the saved copy of a changed record based upon its current change time and modification time, and whether there are remote listeners who are interested in receiving notifications of changes

Type Parameters:
T - the type of data record at question
Parameters:
recordLoader - the loader responsible for the data record
record - the data record which has changed