public class ReplCache<K,V> extends Object implements MembershipListener, Cache.ChangeListener
Modifier and Type | Class and Description |
---|---|
static interface |
ReplCache.ChangeListener |
static class |
ReplCache.ConsistentHashFunction<K> |
static interface |
ReplCache.HashFunction<K> |
static interface |
ReplCache.HashFunctionFactory<K> |
static class |
ReplCache.Value<V>
Uses arrays to store hash values of addresses, plus addresses.
|
Modifier and Type | Field and Description |
---|---|
protected static Map<Short,Method> |
methods |
Constructor and Description |
---|
ReplCache(String props,
String cluster_name) |
Modifier and Type | Method and Description |
---|---|
Cache.Value<ReplCache.Value<V>> |
_get(K key) |
V |
_put(K key,
V val,
short repl_count,
long timeout) |
V |
_put(K key,
V val,
short repl_count,
long timeout,
boolean force) |
V |
_remove(K key) |
void |
_removeMany(Set<K> keys) |
void |
addChangeListener(ReplCache.ChangeListener l) |
void |
addMembershipListener(MembershipListener l) |
void |
block()
Called (usually by the FLUSH protocol), as an indication that the member should stop sending messages.
|
void |
changed() |
void |
clear()
Removes all keys and values in the L2 and L1 caches
|
String |
dump() |
V |
get(K key)
Returns the value associated with key
|
long |
getCachingTime() |
long |
getCallTimeout() |
String |
getClusterName() |
int |
getClusterSize() |
short |
getDefaultReplicationCount() |
ReplCache.HashFunction |
getHashFunction() |
ReplCache.HashFunctionFactory |
getHashFunctionFactory() |
Cache<K,V> |
getL1Cache() |
Cache<K,ReplCache.Value<V>> |
getL2Cache() |
Address |
getLocalAddress() |
String |
getLocalAddressAsString() |
String |
getProps() |
String |
getView() |
boolean |
isL1CacheEnabled() |
boolean |
isMigrateData() |
void |
mcastEntries() |
void |
put(K key,
V val) |
void |
put(K key,
V val,
short repl_count,
long timeout)
Places a key/value pair into one or several nodes in the cluster.
|
void |
put(K key,
V val,
short repl_count,
long timeout,
boolean synchronous)
Places a key/value pair into one or several nodes in the cluster.
|
void |
remove(K key)
Removes key in all nodes in the cluster, both from their local hashmaps and L1 caches
|
void |
remove(K key,
boolean synchronous)
Removes key in all nodes in the cluster, both from their local hashmaps and L1 caches
|
void |
removeChangeListener(ReplCache.ChangeListener l) |
void |
removeMembershipListener(MembershipListener l) |
void |
setCachingTime(long caching_time) |
void |
setCallTimeout(long call_timeout) |
void |
setClusterName(String cluster_name) |
void |
setDefaultReplicationCount(short default_replication_count) |
void |
setHashFunction(ReplCache.HashFunction<K> hash_function) |
void |
setHashFunctionFactory(ReplCache.HashFunctionFactory<K> hash_function_factory) |
void |
setL1Cache(Cache<K,V> cache) |
void |
setL2Cache(Cache<K,ReplCache.Value<V>> cache) |
void |
setMigrateData(boolean migrate_data) |
void |
setProps(String props) |
void |
start() |
void |
stop() |
void |
suspect(Address suspected_mbr)
Called whenever a member is suspected of having crashed,
but has not yet been excluded.
|
String |
toString() |
void |
viewAccepted(View new_view)
Called when a change in membership has occurred.
|
public String getProps()
public void setProps(String props)
public Address getLocalAddress()
public String getLocalAddressAsString()
public String getView()
public int getClusterSize()
public boolean isL1CacheEnabled()
public String getClusterName()
public void setClusterName(String cluster_name)
public long getCallTimeout()
public void setCallTimeout(long call_timeout)
public long getCachingTime()
public void setCachingTime(long caching_time)
public boolean isMigrateData()
public void setMigrateData(boolean migrate_data)
public short getDefaultReplicationCount()
public void setDefaultReplicationCount(short default_replication_count)
public ReplCache.HashFunction getHashFunction()
public void setHashFunction(ReplCache.HashFunction<K> hash_function)
public ReplCache.HashFunctionFactory getHashFunctionFactory()
public void setHashFunctionFactory(ReplCache.HashFunctionFactory<K> hash_function_factory)
public void addMembershipListener(MembershipListener l)
public void removeMembershipListener(MembershipListener l)
public void addChangeListener(ReplCache.ChangeListener l)
public void removeChangeListener(ReplCache.ChangeListener l)
public Cache<K,ReplCache.Value<V>> getL2Cache()
public void setL2Cache(Cache<K,ReplCache.Value<V>> cache)
public void stop()
public void put(K key, V val, short repl_count, long timeout, boolean synchronous)
key
- The key, needs to be serializableval
- The value, needs to be serializablerepl_count
- Number of replicas. The total number of times a data item should be present in a cluster.
Needs to be > 0
timeout
- Expiration time for key/value.
synchronous
- Whether or not to block until all cluster nodes have applied the changepublic void put(K key, V val, short repl_count, long timeout)
key
- The key, needs to be serializableval
- The value, needs to be serializablerepl_count
- Number of replicas. The total number of times a data item should be present in a cluster.
Needs to be > 0
timeout
- Expiration time for key/value.
public V get(K key)
key
- The key, has to be serializablepublic void remove(K key)
key
- The key, needs to be serializablepublic void remove(K key, boolean synchronous)
key
- The key, needs to be serializablepublic void clear()
public V _put(K key, V val, short repl_count, long timeout, boolean force)
key
- val
- repl_count
- timeout
- force
- Skips acceptance checking and simply adds the key/valuepublic Cache.Value<ReplCache.Value<V>> _get(K key)
public void viewAccepted(View new_view)
MembershipListener
Channel.connect(String)
returns.viewAccepted
in interface MembershipListener
public void suspect(Address suspected_mbr)
MembershipListener
suspect
in interface MembershipListener
public void block()
MembershipListener
ExtendedMembershipListener.unblock()
.
Note that block() is the equivalent of reception of a BlockEvent in the pull mode.block
in interface MembershipListener
public void changed()
changed
in interface Cache.ChangeListener
public String dump()
public void mcastEntries()
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.