protected void start ( ) { try { if ( ! db . isOpen ( ) ) { String msg = String . format ( Locale . ENGLISH , "Db: %s is not open, abort replication" , db ) ; parentReplication . setLastError ( new Exception ( msg ) ) ; fireTrigger ( ReplicationTrigger . STOP_IMMEDIATE ) ; return ; } db . addActiveReplication ( parentReplication ) ; this . authenticating = false ; initSessionId ( ) ; // initialize batcher initBatcher ( ) ; // initialize authorizer / authenticator initAuthorizer ( ) ; // initialize request workers initializeRequestWorkers ( ) ; // reset lastSequence // https://github.com/couchbase/couchbase-lite-java-core/issues/1623 this . lastSequence = null ; // single-shot replication if ( ! isContinuous ( ) ) goOnline ( ) ; // continuous mode else { if ( isNetworkReachable ( ) ) goOnline ( ) ; else triggerGoOffline ( ) ; startNetworkReachabilityManager ( ) ; } } catch ( Exception e ) { Log . e ( Log . TAG_SYNC , "%s: Exception in start()" , e , this ) ; } }
Start the replication process .