}
else if ( new File( sourceIndexDir, "current2" ).exists() ) {
sourceCurrent = 2;
}
else {
throw new SearchException( "No current file marker found in source directory: " + sourceIndexDir.getPath() );
}
try {
FileHelper.synchronize(
new File( sourceIndexDir, String.valueOf( sourceCurrent ) ),
destinationFile, true, copyChunkSize
);
}
catch ( IOException e ) {
throw new SearchException( "Unable to synchronize directory: " + indexName, e );
}
if ( !currentMarker.createNewFile() ) {
throw new SearchException( "Unable to create the directory marker file: " + indexName );
}
}
log.debug( "Current directory: {}", currentToBe );
}
catch ( IOException e ) {
throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
}
task = new TriggerTask( sourceIndexDir, indexDir );
long period = DirectoryProviderHelper.getRefreshPeriod( properties, directoryProviderName );
timer.scheduleAtFixedRate( task, period, period );
this.current = currentToBe;