| org.apache.catalina.tribes.tipis.ReplicatedMapEntry
All known Subclasses: org.apache.catalina.ha.session.DeltaSession,
ReplicatedMapEntry | public interface ReplicatedMapEntry extends Serializable(Code) | | For smarter replication, an object can implement this interface to replicate diffs
The replication logic will call the methods in the following order:
1. if ( entry.isDirty() )
try {
2. entry.lock();
3. byte[] diff = entry.getDiff();
4. entry.reset();
} finally {
5. entry.unlock();
}
}
When the data is deserialized the logic is called in the following order
1. ReplicatedMapEntry entry = (ReplicatedMapEntry)objectIn.readObject();
2. if ( isBackup(entry)||isPrimary(entry) ) entry.setOwner(owner);
author: Filip Hanik version: 1.0 |
Method Summary | |
public void | applyDiff(byte[] diff, int offset, int length) Applies a diff to an existing object. | public byte[] | getDiff() | public long | getVersion() For accuracy checking, a serialized attribute can contain a version number
This number increases as modifications are made to the data. | public boolean | isDiffable() If this returns true, the map will extract the diff using getDiff()
Otherwise it will serialize the entire object. | public boolean | isDirty() | public void | lock() | public void | resetDiff() | public void | setOwner(Object owner) This method is called after the object has been
created on a remote map. | public void | setVersion(long version) | public void | unlock() |
getVersion | public long getVersion()(Code) | | For accuracy checking, a serialized attribute can contain a version number
This number increases as modifications are made to the data.
The replicated map can use this to ensure accuracy on a periodic basis
long - the version number or -1 if the data is not versioned |
isDiffable | public boolean isDiffable()(Code) | | If this returns true, the map will extract the diff using getDiff()
Otherwise it will serialize the entire object.
boolean |
isDirty | public boolean isDirty()(Code) | | Has the object changed since last replication
and is not in a locked state
boolean |
lock | public void lock()(Code) | | Lock during serialization
|
resetDiff | public void resetDiff()(Code) | | Resets the current diff state and resets the dirty flag
|
setOwner | public void setOwner(Object owner)(Code) | | This method is called after the object has been
created on a remote map. On this method,
the object can initialize itself for any data that wasn't
Parameters: owner - Object |
setVersion | public void setVersion(long version)(Code) | | Forces a certain version to a replicated map entry
Parameters: version - long |
unlock | public void unlock()(Code) | | Unlock after serialization
|
|
|