org.jasig.portal.utils
Class PooledCounterStore

java.lang.Object
  extended by org.jasig.portal.utils.PooledCounterStore
All Implemented Interfaces:
ICounterStore

public class PooledCounterStore
extends Object
implements ICounterStore

Version:
$Revision$
Author:
Eric Dalquist

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
PooledCounterStore()
           
 
Method Summary
 void createCounter(String counterName)
          Create a new coutner
 int getIncrement()
           
 int getIncrementIntegerId(String counterName)
          Obtain current coutner value and increment it.
 int getInitialValue()
           
 int getMaxWait()
           
 int getMinWait()
           
 int getRetryCount()
           
 void reset()
           
 void setCounter(String counterName, int value)
          Reset a value of a counter.
 void setDataSource(DataSource dataSource)
          The DataSource to use for counter generation
 void setIncrement(int increment)
          In-memory counter value pool size.
 void setInitialValue(int initialValue)
          Initial value to set for a counter when creating it
 void setMaxWait(int maxWait)
          Maximum number of milliseconds to wait between retries
 void setMinWait(int minWait)
          Minimum number of milliseconds to wait between retries
 void setRetryCount(int retryCount)
          Number of attempts to make when a database update fails to to concurrent update from another machine
 void setTransactionManager(PlatformTransactionManager transactionManager)
          The transaction manager to use for updates to the counter table
protected  void waitToRetry()
          Blocks for the number of milliseconds computed via the minWait and maxWait properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

PooledCounterStore

public PooledCounterStore()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
The DataSource to use for counter generation


setTransactionManager

public void setTransactionManager(PlatformTransactionManager transactionManager)
The transaction manager to use for updates to the counter table


getInitialValue

public int getInitialValue()

setInitialValue

public void setInitialValue(int initialValue)
Initial value to set for a counter when creating it


getIncrement

public int getIncrement()

setIncrement

public void setIncrement(int increment)
In-memory counter value pool size. The higher this value the fewer database access will be needed but more values may be lost at app shutdown


getRetryCount

public int getRetryCount()

setRetryCount

public void setRetryCount(int retryCount)
Number of attempts to make when a database update fails to to concurrent update from another machine


getMinWait

public int getMinWait()

setMinWait

public void setMinWait(int minWait)
Minimum number of milliseconds to wait between retries


getMaxWait

public int getMaxWait()

setMaxWait

public void setMaxWait(int maxWait)
Maximum number of milliseconds to wait between retries


createCounter

public void createCounter(String counterName)
Description copied from interface: ICounterStore
Create a new coutner

Specified by:
createCounter in interface ICounterStore
Parameters:
counterName - a name for the new counter

getIncrementIntegerId

public int getIncrementIntegerId(String counterName)
Description copied from interface: ICounterStore
Obtain current coutner value and increment it.

Specified by:
getIncrementIntegerId in interface ICounterStore
Parameters:
counterName - a String value
Returns:
an int value

setCounter

public void setCounter(String counterName,
                       int value)
Description copied from interface: ICounterStore
Reset a value of a counter.

Specified by:
setCounter in interface ICounterStore
Parameters:
counterName - a counter name
value - a new counter value

reset

public void reset()

waitToRetry

protected void waitToRetry()
Blocks for the number of milliseconds computed via the minWait and maxWait properties



Copyright © 2010 Jasig. All Rights Reserved.