|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.terracotta.toolkit.builder.ToolkitStoreConfigBuilder
public final class ToolkitStoreConfigBuilder
A helper to build a Configuration
for ToolkitStore
. Builds up configuration based on
ToolkitConfigFields
Constructor Summary | |
---|---|
ToolkitStoreConfigBuilder()
|
Method Summary | |
---|---|
protected void |
addFieldToApply(String name,
Serializable value)
|
void |
apply(ToolkitCache cache)
Apply changes of this builder to the ToolkitStore parameter. |
void |
apply(ToolkitStore store)
Apply changes of this builder to the ToolkitStore parameter. |
Configuration |
build()
Builds a Configuration for ToolkitStore by filling in appropriate mappings. |
ToolkitStoreConfigBuilder |
compressionEnabled(boolean compressionEnabledParam)
Sets compression enabled |
ToolkitStoreConfigBuilder |
concurrency(int concurrencyParam)
Sets the concurrency config to the new value and returns this |
ToolkitStoreConfigBuilder |
configField(String fieldName,
Serializable value)
|
ToolkitStoreConfigBuilder |
consistency(ToolkitConfigFields.Consistency consistencyParam)
Sets the ToolkitConfigFields.Consistency of the key-value store |
ToolkitStoreConfigBuilder |
copyOnReadEnabled(boolean copyOnReadEnabledParam)
Sets copy on read enabled |
int |
getConcurrency()
Concurrency of the store |
ToolkitConfigFields.Consistency |
getConsistency()
Getter for consistency |
long |
getMaxBytesLocalHeap()
Gets the max bytes local heap |
long |
getMaxBytesLocalOffheap()
Gets the max bytes local offheap |
long |
getMaxCountLocalHeap()
Gets the max count local heap |
boolean |
isCompressionEnabled()
Compression enabled or not getter |
boolean |
isCopyOnReadEnabled()
copy-on-read enabled or not getter |
boolean |
isLocalCacheEnabled()
Query whether local cache is enabled or not |
boolean |
isOffheapEnabled()
Returns true if offheap is enabled |
boolean |
isPinnedInLocalMemory()
|
ToolkitStoreConfigBuilder |
localCacheEnabled(boolean localCacheEnabledParam)
Sets local cache enabled |
ToolkitStoreConfigBuilder |
maxBytesLocalHeap(long maxBytesLocalHeapParam)
Sets the maxBytesLocalHeap |
ToolkitStoreConfigBuilder |
maxBytesLocalOffheap(long maxBytesLocalOffheapParam)
Sets the max bytes local offheap |
ToolkitStoreConfigBuilder |
maxCountLocalHeap(int maxCountLocalHeapParam)
Sets the max count local heap |
ToolkitStoreConfigBuilder |
offheapEnabled(boolean offheapEnabledParam)
Sets offheap enabled |
ToolkitStoreConfigBuilder |
pinnedInLocalMemory(boolean pinnedInLocalMemory)
Sets whether entries should be pinned in local memory |
protected void |
setCompressionEnabled(boolean compressionEnabledParam)
Sets compression enabled |
protected void |
setConcurrency(int concurrencyParam)
|
protected void |
setConfigField(String fieldName,
Serializable value)
|
protected void |
setConsistency(ToolkitConfigFields.Consistency consistencyParam)
Sets the ToolkitConfigFields.Consistency of the key-value store |
protected void |
setCopyOnReadEnabled(boolean copyOnReadEnabledParam)
Sets copy on read enabled |
protected void |
setLocalCacheEnabled(boolean localCacheEnabledParam)
Sets local cache enabled |
protected void |
setMaxBytesLocalHeap(long maxBytesLocalHeapParam)
Sets the maxBytesLocalHeap |
protected void |
setMaxBytesLocalOffheap(long maxBytesLocalOffheapParam)
Sets the max bytes local offheap |
protected void |
setMaxCountLocalHeap(int maxCountLocalHeapParam)
Sets the max count local heap |
protected void |
setOffheapEnabled(boolean offheapEnabledParam)
Sets offheap enabled |
void |
setPinnedInLocalMemory(boolean pinnedInLocalMemory)
Sets whether entries should be pinned in local memory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolkitStoreConfigBuilder()
Method Detail |
---|
public ToolkitStoreConfigBuilder concurrency(int concurrencyParam) throws IllegalArgumentException
this
IllegalArgumentException
- for non-positive concurrency paramspublic ToolkitStoreConfigBuilder consistency(ToolkitConfigFields.Consistency consistencyParam)
ToolkitConfigFields.Consistency
of the key-value store
public ToolkitStoreConfigBuilder pinnedInLocalMemory(boolean pinnedInLocalMemory)
public ToolkitStoreConfigBuilder maxBytesLocalHeap(long maxBytesLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitStoreConfigBuilder maxBytesLocalOffheap(long maxBytesLocalOffheapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitStoreConfigBuilder maxCountLocalHeap(int maxCountLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuespublic ToolkitStoreConfigBuilder offheapEnabled(boolean offheapEnabledParam)
public ToolkitStoreConfigBuilder localCacheEnabled(boolean localCacheEnabledParam)
public ToolkitStoreConfigBuilder compressionEnabled(boolean compressionEnabledParam)
public ToolkitStoreConfigBuilder copyOnReadEnabled(boolean copyOnReadEnabledParam)
public ToolkitStoreConfigBuilder configField(String fieldName, Serializable value)
protected void addFieldToApply(String name, Serializable value)
public int getConcurrency()
public ToolkitConfigFields.Consistency getConsistency()
ToolkitConfigFields.Consistency
of the key-value storepublic long getMaxBytesLocalHeap()
public long getMaxBytesLocalOffheap()
public long getMaxCountLocalHeap()
public boolean isOffheapEnabled()
public boolean isLocalCacheEnabled()
public boolean isCompressionEnabled()
public void setPinnedInLocalMemory(boolean pinnedInLocalMemory)
public boolean isPinnedInLocalMemory()
public boolean isCopyOnReadEnabled()
protected void setConcurrency(int concurrencyParam) throws IllegalArgumentException
IllegalArgumentException
protected void setConsistency(ToolkitConfigFields.Consistency consistencyParam)
ToolkitConfigFields.Consistency
of the key-value store
protected void setMaxBytesLocalHeap(long maxBytesLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setMaxBytesLocalOffheap(long maxBytesLocalOffheapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setMaxCountLocalHeap(int maxCountLocalHeapParam) throws IllegalArgumentException
IllegalArgumentException
- for negative valuesprotected void setOffheapEnabled(boolean offheapEnabledParam)
protected void setLocalCacheEnabled(boolean localCacheEnabledParam)
protected void setCompressionEnabled(boolean compressionEnabledParam)
protected void setCopyOnReadEnabled(boolean copyOnReadEnabledParam)
protected void setConfigField(String fieldName, Serializable value)
public Configuration build()
Configuration
for ToolkitStore
by filling in appropriate mappings. Only adds mappings for
values which were set explicitly in this builder, and doesn’t fills in default values in the returned config.
Consult ToolkitConfigFields
for the various configs supported and its default values
public void apply(ToolkitStore store)
ToolkitStore
parameter. The changes are the ones between each apply.
If the store's configuration has ToolkitConfigFields.MAX_BYTES_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxCountLocalHeap(int)
would result in an error.
If the store's configuration has ToolkitConfigFields.MAX_COUNT_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxBytesLocalHeap(long)
would result in an error.
public void apply(ToolkitCache cache)
ToolkitStore
parameter. The changes are the ones between each apply.
If the store's configuration has ToolkitConfigFields.MAX_BYTES_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxCountLocalHeap(int)
would result in an error.
If the store's configuration has ToolkitConfigFields.MAX_COUNT_LOCAL_HEAP_FIELD_NAME
property set then
AbstractToolkitStoreCacheConfigBuilder.setMaxBytesLocalHeap(long)
would result in an error.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |