public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT ); try { io.writeLong( timestamp.getTime() ); } finally { close( io ); } } } }
public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT ); try { io.writeLong( timestamp.getTime() ); } finally { close( io ); } } } }
public static void updateTimestamp( Directory directory, Date timestamp ) throws IOException { synchronized ( directory ) { Date currentTimestamp = getTimestamp( directory ); if ( timestamp != null && ( currentTimestamp == null || !currentTimestamp.equals( timestamp ) ) ) { deleteTimestamp( directory ); IndexOutput io = directory.createOutput( TIMESTAMP_FILE, IOContext.DEFAULT); try { io.writeLong( timestamp.getTime() ); io.flush(); } finally { close( io ); } } } }
IndexUtils.deleteTimestamp( indexDirectory );
IndexUtils.deleteTimestamp( indexDirectory );
private void deleteIndexFiles( boolean full ) throws IOException { if ( indexDirectory != null ) { String[] names = indexDirectory.listAll(); if ( names != null ) { for (String name : names) { if (! (name.equals(INDEX_PACKER_PROPERTIES_FILE) || name.equals(INDEX_UPDATER_PROPERTIES_FILE) )) { indexDirectory.deleteFile(name); } } } if ( full ) { if ( indexDirectory.fileExists( INDEX_PACKER_PROPERTIES_FILE ) ) { indexDirectory.deleteFile( INDEX_PACKER_PROPERTIES_FILE ); } if ( indexDirectory.fileExists( INDEX_UPDATER_PROPERTIES_FILE ) ) { indexDirectory.deleteFile( INDEX_UPDATER_PROPERTIES_FILE ); } } IndexUtils.deleteTimestamp( indexDirectory ); } }