public abstract class AbstractReplicator extends BaseReplicator
Modifier and Type | Method and Description |
---|---|
ListenerToken |
addChangeListener(Executor executor,
ReplicatorChangeListener listener)
Adds a change listener for the changes in the replication status and progress with an executor on which
the changes will be posted to the listener.
|
ListenerToken |
addChangeListener(ReplicatorChangeListener listener)
Adds a change listener for the changes in the replication status and progress.
|
ListenerToken |
addDocumentReplicationListener(DocumentReplicationListener listener)
Adds a listener for receiving the replication status of the specified document.
|
ListenerToken |
addDocumentReplicationListener(Executor executor,
DocumentReplicationListener listener)
Adds a listener for receiving the replication status of the specified document with an executor on which
the status will be posted to the listener.
|
ReplicatorConfiguration |
getConfig()
The replicator's configuration.
|
Set<String> |
getPendingDocumentIds()
Get a best effort list of documents still pending replication.
|
List<Certificate> |
getServerCertificates()
The server certificates received from the server during the TLS handshake.
|
ReplicatorStatus |
getStatus()
The replicator's current status: its activity level and progress.
|
boolean |
isDocumentPending(String docId)
Best effort check to see if the document whose ID is passed is still pending replication.
|
void |
removeChangeListener(ListenerToken token)
Remove the given ReplicatorChangeListener or DocumentReplicationListener from the this replicator.
|
void |
start()
Start the replicator.
|
void |
start(boolean resetCheckpoint)
Start the replicator.
|
void |
stop()
Stop a running replicator.
|
String |
toString() |
close, getC4Replicator
public void start()
public void start(boolean resetCheckpoint)
public void stop()
@NonNull public ReplicatorConfiguration getConfig()
@NonNull public ReplicatorStatus getStatus()
@Nullable public List<Certificate> getServerCertificates()
@NonNull public Set<String> getPendingDocumentIds() throws CouchbaseLiteException
CouchbaseLiteException
public boolean isDocumentPending(@NonNull String docId) throws CouchbaseLiteException
docId
- Document idCouchbaseLiteException
@NonNull public ListenerToken addChangeListener(@NonNull ReplicatorChangeListener listener)
The changes will be delivered on the UI thread for the Android platform On other Java platforms, the callback will occur on an arbitrary thread.
When developing a Java Desktop application using Swing or JavaFX that needs to update the UI after receiving the changes, make sure to schedule the UI update on the UI thread by using SwingUtilities.invokeLater(Runnable) or Platform.runLater(Runnable) respectively.
listener
- callback@NonNull public ListenerToken addChangeListener(@Nullable Executor executor, @NonNull ReplicatorChangeListener listener)
executor
- executor on which events will be deliveredlistener
- callback@NonNull public ListenerToken addDocumentReplicationListener(@NonNull DocumentReplicationListener listener)
listener
- callback@NonNull public ListenerToken addDocumentReplicationListener(@Nullable Executor executor, @NonNull DocumentReplicationListener listener)
executor
- executor on which events will be deliveredlistener
- callbackpublic void removeChangeListener(@NonNull ListenerToken token)
token
- returned by a previous call to addChangeListener or addDocumentListener.