|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.blocks.ReplCache<K,V>
public class ReplCache<K,V>
Cache which allows for replication factors per data items; the factor determines how many replicas
of a key/value we create across the cluster.
See doc/design/ReplCache.txt for details.
Nested Class Summary | |
---|---|
static interface |
ReplCache.ChangeListener
|
static class |
ReplCache.ConsistentHashFunction<K>
|
static interface |
ReplCache.HashFunction<K>
|
static interface |
ReplCache.HashFunctionFactory<K>
|
static class |
ReplCache.Value<V>
|
Field Summary | |
---|---|
protected static java.util.Map<java.lang.Short,java.lang.reflect.Method> |
methods
|
Constructor Summary | |
---|---|
ReplCache(java.lang.String props,
java.lang.String cluster_name)
|
Method Summary | |
---|---|
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(java.util.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 |
java.lang.String |
dump()
|
V |
get(K key)
Returns the value associated with key |
long |
getCachingTime()
|
long |
getCallTimeout()
|
java.lang.String |
getClusterName()
|
int |
getClusterSize()
|
short |
getDefaultReplicationCount()
|
ReplCache.HashFunction |
getHashFunction()
|
ReplCache.HashFunctionFactory |
getHashFunctionFactory()
|
Cache<K,V> |
getL1Cache()
|
Cache<K,ReplCache.Value<V>> |
getL2Cache()
|
Address |
getLocalAddress()
|
java.lang.String |
getLocalAddressAsString()
|
java.lang.String |
getProps()
|
java.lang.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(java.lang.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(java.lang.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. |
java.lang.String |
toString()
|
void |
unblock()
Called after the FLUSH protocol has unblocked previously blocked senders, and messages can be sent again. |
void |
viewAccepted(View new_view)
Called when a change in membership has occurred. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.util.Map<java.lang.Short,java.lang.reflect.Method> methods
Constructor Detail |
---|
public ReplCache(java.lang.String props, java.lang.String cluster_name)
Method Detail |
---|
public java.lang.String getProps()
public void setProps(java.lang.String props)
public Address getLocalAddress()
public java.lang.String getLocalAddressAsString()
public java.lang.String getView()
public int getClusterSize()
public boolean isL1CacheEnabled()
public java.lang.String getClusterName()
public void setClusterName(java.lang.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,V> getL1Cache()
public void setL1Cache(Cache<K,V> cache)
public Cache<K,ReplCache.Value<V>> getL2Cache()
public void setL2Cache(Cache<K,ReplCache.Value<V>> cache)
public void start() throws java.lang.Exception
java.lang.Exception
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 void put(K key, V val)
public V get(K key)
key
- The key, has to be serializable
public 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)
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/value
public Cache.Value<ReplCache.Value<V>> _get(K key)
public V _remove(K key)
public void _removeMany(java.util.Set<K> keys)
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
MembershipListener.unblock()
. Note that block() is the equivalent
of reception of a BlockEvent in the pull mode.
block
in interface MembershipListener
public void unblock()
MembershipListener
Note that during new view installation we provide guarantee that unblock invocation strictly follows view installation at some node A belonging to that view . However, some other message M may squeeze in between view and unblock callbacks. For more details see https://jira.jboss.org/jira/browse/JGRP-986
unblock
in interface MembershipListener
public void changed()
changed
in interface Cache.ChangeListener
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String dump()
public void mcastEntries()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |