public class SerializationGroupImpl<K extends Serializable,V extends Cacheable<K>> extends AbstractBackingCacheEntry<UUID,Cacheable<UUID>> implements SerializationGroup<K,V,UUID>
Constructor and Description |
---|
SerializationGroupImpl(UUID id) |
Modifier and Type | Method and Description |
---|---|
void |
addActive(SerializationGroupMember<K,V,UUID> member)
Records that the given member is "active"; i.e.
|
void |
addInUse(K key)
Notification that the given member is "in use", and therefore the group should not be serialized.
|
void |
addMember(SerializationGroupMember<K,V,UUID> member)
Initially associates a new member with the group.
|
PassivatingBackingCache<UUID,Cacheable<UUID>,SerializationGroup<K,V,UUID>> |
getGroupCache()
Gets the cache used to manage the group.
|
UUID |
getId()
The object identifier.
|
int |
getInUseCount()
Gets the number of members currently in use.
|
V |
getMemberObject(K key)
|
Cacheable<UUID> |
getUnderlyingItem()
FIXME -- returns null; what should it do?
|
boolean |
isClustered()
Gets whether this groups supports (and requires) clustering functionality from its members.
|
boolean |
isGroupModified()
Returns whether the group has been modified.
|
boolean |
isModified()
Gets whether this object's internal state has been modified since
the last request to this method.
|
void |
lock()
Lock this item, blocking until the lock is acquired.
|
void |
postActivate()
Notification that the group has been activated from a passivated state.
|
void |
postReplicate()
Notification that the previously replicated group has been retrieved from a clustered cache.
|
void |
prePassivate()
Prepare members for passivation.
|
void |
preReplicate()
Prepare members for replication.
|
void |
removeActive(K key)
Records that the given member is no longer "active"; i.e.
|
void |
removeInUse(K key)
Notification that the given member is no longer "in use", and therefore should not prevent the group being serialized.
|
void |
removeMember(K key)
Remove the specified member from the group.
|
void |
setClustered(boolean clustered)
Sets whether this groups supports (and requires) clustering functionality from its members.
|
void |
setGroupCache(PassivatingBackingCache<UUID,Cacheable<UUID>,SerializationGroup<K,V,UUID>> groupCache)
Handback provided by the cache managing the group.
|
void |
setGroupModified(boolean modified)
Sets the modified state.
|
int |
size()
Gets the number of group members.
|
String |
toString() |
boolean |
tryLock()
Attempt to lock this item, failing promptly if the lock is already held by another thread.
|
void |
unlock()
Unlock this item.
|
compareTo, equals, getLastUsed, hashCode, invalidate, isInUse, isPrePassivated, isValid, setInUse, setLastUsed, setPrePassivated
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getLastUsed, invalidate, isInUse, isPrePassivated, isValid, setInUse, setPrePassivated
compareTo
public SerializationGroupImpl(UUID id)
public UUID getId()
Identifiable
getId
in interface Identifiable<UUID>
public boolean isClustered()
true
if clustering is supported, false
otherwisepublic void setClustered(boolean clustered)
public void addMember(SerializationGroupMember<K,V,UUID> member)
marks the member as
active
.addMember
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
member
- IllegalStateException
- if member
was previously added to the grouppublic void removeMember(K key)
removeMember
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
key
- the id
of the memberpublic int size()
size
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public V getMemberObject(K key)
getMemberObject
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
key
- the id
of the membernull
if key
does not identify a member.public void prePassivate()
prePassivate
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public void postActivate()
postActivate
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public void preReplicate()
preReplicate
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public void postReplicate()
postReplicate
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public void addActive(SerializationGroupMember<K,V,UUID> member)
addActive
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
member
- the memberIllegalStateException
- if member
wasn't previously added to the group via
addMember(SerializationGroupMember)
public void removeActive(K key)
removeActive
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
key
- the id
of the memberIllegalStateException
- if member
wasn't previously added to the group via
addMember(SerializationGroupMember)
public void addInUse(K key)
addInUse
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
key
- the id
of the memberIllegalStateException
- if member
wasn't previously added to the group via
addMember(SerializationGroupMember)
public void removeInUse(K key)
removeInUse
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
key
- the id
of the memberIllegalStateException
- if member
wasn't previously added to the group via
addMember(SerializationGroupMember)
public int getInUseCount()
getInUseCount
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public boolean isModified()
Cacheable
Implementations must be aggressive about returning true
if
they are uncertain about whether they have been modified; false
should only be returned if the implementing object is certain its
internal state has not been modified.
isModified
in interface Cacheable<UUID>
true
if the state has been modified or the
implementing object does not know; false
otherwise.public boolean isGroupModified()
SerializationGroup
Cacheable.isModified()
in that invoking this method
does not clear the modified state.
isGroupModified
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
public void setGroupModified(boolean modified)
SerializationGroup
setGroupModified
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
modified
- true
if the group should be considered to have been modified, false
if notpublic Cacheable<UUID> getUnderlyingItem()
getUnderlyingItem
in interface BackingCacheEntry<UUID,Cacheable<UUID>>
public PassivatingBackingCache<UUID,Cacheable<UUID>,SerializationGroup<K,V,UUID>> getGroupCache()
SerializationGroup
getGroupCache
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
null
if the group has been serialized and not yet activated.public void lock()
BackingCacheEntry
RuntimeException
will be thrown if the thread is interrupted instead of
InterruptedException
.lock
in interface BackingCacheEntry<UUID,Cacheable<UUID>>
public boolean tryLock()
BackingCacheEntry
tryLock
in interface BackingCacheEntry<UUID,Cacheable<UUID>>
true
if the lock was acquired, false
otherwisepublic void unlock()
BackingCacheEntry
unlock
in interface BackingCacheEntry<UUID,Cacheable<UUID>>
public void setGroupCache(PassivatingBackingCache<UUID,Cacheable<UUID>,SerializationGroup<K,V,UUID>> groupCache)
SerializationGroup
setGroupCache
in interface SerializationGroup<K extends Serializable,V extends Cacheable<K>,UUID>
groupCache
- the cache. Cannot be null
.Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.