public interface SyncListener
Provides a callback mechanism by which applicable listeners can be notified
when a WriteAheadRepository is synched (via the
WriteAheadRepository#sync()
method) or one of its partitions is
synched via
WriteAheadRepository.update(java.util.Collection, boolean)
with a
value of true
for the second argument.
It is not required that an implementation of WriteAheadRepository
support this interface. Those that do generally will require that the
listener be injected via the constructor.
All implementations of this interface must be thread-safe.
The onSync(int)
method will always be called while the associated
partition is locked. The onGlobalSync()
will always be called while
the entire repository is locked.
Modifier and Type | Method and Description |
---|---|
void |
onGlobalSync()
This method is called whenever the entire
WriteAheadRepository is synched via the
WriteAheadRepository#sync() method. |
void |
onSync(int partitionIndex)
This method is called whenever a specific partition is synched via the
WriteAheadRepository.update(java.util.Collection, boolean) method |
void onSync(int partitionIndex)
WriteAheadRepository.update(java.util.Collection, boolean)
methodpartitionIndex
- the index of the partition that was synchedvoid onGlobalSync()
WriteAheadRepository
is synched via the
WriteAheadRepository#sync()
method.