public interface StateSynchronizer
It is up to the implementer of this interface to determine if partial or incremental changes can be sent or whether all changes must be sent each time. If at all possible, it is best to only send the changes and when no changes have been made, to send nothing. This is significantly more efficient at the protocol level.
Modifier and Type | Method and Description |
---|---|
void |
applyChanges(java.io.Externalizable changes)
Called by the protocol driver upon reading a message that contains
state changes that need to be applied to this side of the connection.
|
java.io.Externalizable |
getChanges()
Called by the protocol driver to obtain the latest state that should
be sent to the other side of the connection.
|
java.io.Externalizable getChanges()
To enable incremental changes, it is guaranteed that this method will be called every time any message is sent to the other side of the connection. In addition, this will only be called once per message.
In a system in which control flow is "sent" to the other side of the
connection (a type of "conversation" or single-threaded synchronous
mode), it is further guaranteed that any changes that are made at the
other side after this is called will result in a call to this side's
applyChanges(java.io.Externalizable)
method before this method is ever called again
(when control flow returns to this side of the connection). This allows
one to ensure that on the call to this method, any "dirty" flags can be
safely cleared and the state of this side will be updated with
the results of the other side's changes before this method must ever
again check to see if there are changes to send.
null
if no changes need to be sent.void applyChanges(java.io.Externalizable changes)
changes
- The payload of state changes that must be locally applied.