Top Description Fields Constructors Methods
net.sf.ehcache.constructs.refreshahead

public Class RefreshAheadCacheConfiguration

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.util.Properties, java.util.concurrent.TimeUnit

Fluent configuration class for RefreshAheadCache instances.
Author
cschanck

Field Summary

Modifier and TypeField and Description
public static final String
BATCH_SIZE_KEY

Properties key for the batch size attribute

private int
private static final int
private static final int
private static final int
public static final String
EVICT_ON_LOAD_MISS

Properties key for the batch size attribute

private boolean
public static final String
MAX_BACKLOG

Properties key for the max backlog attribute

private int
private String
public static final String
NAME_KEY

Properties key for the batch size attribute

public static final String
NUMBER_OF_THREADS_KEY

Properties key for the batch size attribute

private int
public static final String
TIME_TO_REFRESH_SECONDS_KEY

Properties key for the batch size attribute

private long
private long
private volatile boolean

Constructor Summary

AccessConstructor and Description
public
RefreshAheadCacheConfiguration()

Create a default, valid configuration

Method Summary

Modifier and TypeMethod and Description
public RefreshAheadCacheConfiguration

Returns:

this configuration object
batchSize
(int
maximum batch size
batchSize
)

Fluently set the batch size for processing refresh requests.

public RefreshAheadCacheConfiguration

Returns:

validated configuration
build
()

Validate this configuration.

private void
public RefreshAheadCacheConfiguration

Returns:

this config
evictOnLoadMiss
(boolean
true to evict
loadMissEvicts
)

Fluently set whether no return for a key from all CacheLoaders should force an eviction prematurely from the underlying cache.

public RefreshAheadCacheConfiguration

Returns:

this configuration
fromProperties
(Properties properties)

Initialize this configuration from a Properties object.

public int

Returns:

batch size
getBatchSize
()

Get the batch size with which refresh requests will be processed.

public int

Returns:

max refresh backlog count
getMaximumRefreshBacklogItems
()

Get the maximum number of backlog items allowed.

public String

Returns:

name
getName
()

Get the name of this cache decorator

public int

Returns:

number of threads
getNumberOfThreads
()

Get the number of threads used locally in this instance to process refresh requests

public long
getTimeToRefreshMillis()

return the time to refresh in milliseconds.

public long

Returns:

time to refresh in seconds
getTimeToRefreshSeconds
()

Get the time to refresh in seconds

public boolean
isEvictOnLoadMiss()

Get whether no return for a key from all CacheLoaders will force an eviction prematurely from the underlying cache.

public RefreshAheadCacheConfiguration
maximumRefreshBacklogItems(int maximumRefreshBacklogItems)

Fluently set the maximum refresh backlog items.

public RefreshAheadCacheConfiguration
name(String name)

Fluently set the name of this cache decorator

public RefreshAheadCacheConfiguration

Returns:

this config object
numberOfThreads
(int
number of threads
numberOfThreads
)

Fluently set the number of threads used locally in this instance to process refresh requests

public void
setBatchSize(int
maximum batch size
batchSize
)

Set the batch size for processing refresh requests.

public void
setEvictOnLoadMiss(boolean
true to evict
loadMissEvicts
)

Set whether no return for a key from all CacheLoaders should force an eviction prematurely from the underlying cache.

public void
setMaximumRefreshBacklogItems(int maximumRefreshBacklogItems)

Set the maximum refresh backlog items.

public void
setName(String name)

Set the name of this cache decorator

public void
setNumberOfThreads(int
number of threads
numberOfThreads
)

Set the number of threads used locally in this instance to process refresh requests

public void
setTimeToRefreshSeconds(long timeToRefreshSeconds)

Set the time to refresh in seconds

public RefreshAheadCacheConfiguration

Returns:

this config
timeToRefreshSeconds
(long
seconds
secs
)

Fluently set the time to refresh seconds

public Properties

Returns:

properties version of this config
toProperties
()

Express this configuration as a Properties object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

BATCH_SIZE_KEYback to summary
public static final String BATCH_SIZE_KEY

Properties key for the batch size attribute

batchSizeback to summary
private int batchSize
DEFAULT_BACKLOG_MAXback to summary
private static final int DEFAULT_BACKLOG_MAX
DEFAULT_BATCHSIZEback to summary
private static final int DEFAULT_BATCHSIZE
DEFAULT_NUMBER_THREADSback to summary
private static final int DEFAULT_NUMBER_THREADS
EVICT_ON_LOAD_MISSback to summary
public static final String EVICT_ON_LOAD_MISS

Properties key for the batch size attribute

evictOnLoadMissback to summary
private boolean evictOnLoadMiss
MAX_BACKLOGback to summary
public static final String MAX_BACKLOG

Properties key for the max backlog attribute

maximumRefreshBacklogItemsback to summary
private int maximumRefreshBacklogItems
nameback to summary
private String name
NAME_KEYback to summary
public static final String NAME_KEY

Properties key for the batch size attribute

NUMBER_OF_THREADS_KEYback to summary
public static final String NUMBER_OF_THREADS_KEY

Properties key for the batch size attribute

numberOfThreadsback to summary
private int numberOfThreads
TIME_TO_REFRESH_SECONDS_KEYback to summary
public static final String TIME_TO_REFRESH_SECONDS_KEY

Properties key for the batch size attribute

timeToRefreshMillisback to summary
private long timeToRefreshMillis
timeToRefreshSecondsback to summary
private long timeToRefreshSeconds
validback to summary
private volatile boolean valid

Constructor Detail

RefreshAheadCacheConfigurationback to summary
public RefreshAheadCacheConfiguration()

Create a default, valid configuration

Method Detail

batchSizeback to summary
public RefreshAheadCacheConfiguration batchSize(int batchSize)

Fluently set the batch size for processing refresh requests.

Parameters
batchSize:int

maximum batch size

Returns:RefreshAheadCacheConfiguration

this configuration object

buildback to summary
public RefreshAheadCacheConfiguration build()

Validate this configuration.

Returns:RefreshAheadCacheConfiguration

validated configuration

checkValidback to summary
private void checkValid()
evictOnLoadMissback to summary
public RefreshAheadCacheConfiguration evictOnLoadMiss(boolean loadMissEvicts)

Fluently set whether no return for a key from all CacheLoaders should force an eviction prematurely from the underlying cache.

Parameters
loadMissEvicts:boolean

true to evict

Returns:RefreshAheadCacheConfiguration

this config

fromPropertiesback to summary
public RefreshAheadCacheConfiguration fromProperties(Properties properties)

Initialize this configuration from a Properties object. Will be validated before returning.

Returns:RefreshAheadCacheConfiguration

this configuration

getBatchSizeback to summary
public int getBatchSize()

Get the batch size with which refresh requests will be processed.

Returns:int

batch size

getMaximumRefreshBacklogItemsback to summary
public int getMaximumRefreshBacklogItems()

Get the maximum number of backlog items allowed. This is the max number of items that this local decorator will allow to be awaiting refresh at one time. If more requests are made than this, requests will begin to be thrown on the floor.

Returns:int

max refresh backlog count

getNameback to summary
public String getName()

Get the name of this cache decorator

Returns:String

name

getNumberOfThreadsback to summary
public int getNumberOfThreads()

Get the number of threads used locally in this instance to process refresh requests

Returns:int

number of threads

getTimeToRefreshMillisback to summary
public long getTimeToRefreshMillis()

return the time to refresh in milliseconds.

getTimeToRefreshSecondsback to summary
public long getTimeToRefreshSeconds()

Get the time to refresh in seconds

Returns:long

time to refresh in seconds

isEvictOnLoadMissback to summary
public boolean isEvictOnLoadMiss()

Get whether no return for a key from all CacheLoaders will force an eviction prematurely from the underlying cache.

maximumRefreshBacklogItemsback to summary
public RefreshAheadCacheConfiguration maximumRefreshBacklogItems(int maximumRefreshBacklogItems)

Fluently set the maximum refresh backlog items.

nameback to summary
public RefreshAheadCacheConfiguration name(String name)

Fluently set the name of this cache decorator

numberOfThreadsback to summary
public RefreshAheadCacheConfiguration numberOfThreads(int numberOfThreads)

Fluently set the number of threads used locally in this instance to process refresh requests

Parameters
numberOfThreads:int

number of threads

Returns:RefreshAheadCacheConfiguration

this config object

setBatchSizeback to summary
public void setBatchSize(int batchSize)

Set the batch size for processing refresh requests.

Parameters
batchSize:int

maximum batch size

setEvictOnLoadMissback to summary
public void setEvictOnLoadMiss(boolean loadMissEvicts)

Set whether no return for a key from all CacheLoaders should force an eviction prematurely from the underlying cache.

Parameters
loadMissEvicts:boolean

true to evict

setMaximumRefreshBacklogItemsback to summary
public void setMaximumRefreshBacklogItems(int maximumRefreshBacklogItems)

Set the maximum refresh backlog items. This is the max number of items which can be queued for refresh processing; above this, keys that are candidates for refresh may be skipped. The correct setting for this will be deployment specific. Too low and refresh opportunities will be skipped; too high and refresh operations could come to dominate processing.

setNameback to summary
public void setName(String name)

Set the name of this cache decorator

setNumberOfThreadsback to summary
public void setNumberOfThreads(int numberOfThreads)

Set the number of threads used locally in this instance to process refresh requests

Parameters
numberOfThreads:int

number of threads

setTimeToRefreshSecondsback to summary
public void setTimeToRefreshSeconds(long timeToRefreshSeconds)

Set the time to refresh in seconds

timeToRefreshSecondsback to summary
public RefreshAheadCacheConfiguration timeToRefreshSeconds(long secs)

Fluently set the time to refresh seconds

Parameters
secs:long

seconds

Returns:RefreshAheadCacheConfiguration

this config

toPropertiesback to summary
public Properties toProperties()

Express this configuration as a Properties object.

Returns:Properties

properties version of this config

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
validateback to summary
private void validate()