public abstract class AbstractReplicator
extends com.couchbase.lite.internal.core.InternalReplicator
Modifier and Type | Class and Description |
---|---|
static class |
AbstractReplicator.ActivityLevel
Activity level of a replicator.
|
static class |
AbstractReplicator.Progress
Progress of a replicator.
|
static class |
AbstractReplicator.Status
Combined activity level and progress of a replicator.
|
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.
|
AbstractReplicator.Status |
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 |
resetCheckpoint()
Deprecated.
Use
start(boolean resetCheckpoint) instead. |
void |
start()
Deprecated.
Use
start(boolean resetCheckpoint) instead. |
void |
start(boolean resetCheckpoint)
Start the replicator.
|
void |
stop()
Stop a running replicator.
|
String |
toString() |
@Deprecated public void start()
start(boolean resetCheckpoint)
instead.resetCheckpoint()
.public void start(boolean resetCheckpoint)
public void stop()
@NonNull public ReplicatorConfiguration getConfig()
@NonNull public AbstractReplicator.Status 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(Executor executor, @NonNull ReplicatorChangeListener 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.@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
- callback@Deprecated public void resetCheckpoint()
start(boolean resetCheckpoint)
instead.start()
IllegalStateException
- unless the Replicator is STOPPED.