replicaLog.setRefreshNPersist( refreshNPersist );
StringValue contexCsnValue = new StringValue( contextCsn );
// modify the filter to include the context Csn
GreaterEqNode csnGeNode = new GreaterEqNode( CSN_AT, contexCsnValue );
ExprNode postInitContentFilter = new AndNode( modifiedFilter, csnGeNode );
request.setFilter( postInitContentFilter );
// now we process entries forever as they change
// irrespective of the sync mode set the 'isRealtimePush' to false initially so that we can
// store the modifications in the queue and later if it is a persist mode
PROVIDER_LOG.debug( "Starting the replicaLog {}", replicaLog );
// we push this queue's content and switch to realtime mode
SyncReplSearchListener replicationListener = new SyncReplSearchListener( session, request, replicaLog, false );
replicaLog.setPersistentListener( replicationListener );
// compose notification criteria and add the listener to the event
// service using that notification criteria to determine which events
// are to be delivered to the persistent search issuing client
NotificationCriteria criteria = new NotificationCriteria();
criteria.setAliasDerefMode( request.getDerefAliases() );
criteria.setBase( request.getBase() );
criteria.setFilter( request.getFilter() );
criteria.setScope( request.getScope() );
criteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK );
replicaLog.setSearchCriteria( criteria );
dirService.getEventService().addListener( replicationListener, criteria );
// then start pushing initial content
LessEqNode csnNode = new LessEqNode( CSN_AT, contexCsnValue );
// modify the filter to include the context Csn
ExprNode initialContentFilter = new AndNode( modifiedFilter, csnNode );
request.setFilter( initialContentFilter );
// Now, do a search to get all the entries
SearchResultDone searchDoneResp = doSimpleSearch( session, request, replicaLog );