private void commitVolatileIndex ( ) throws IOException { // check if volatile index contains documents at all if ( volatileIndex . getNumDocuments ( ) > 0 ) { long time = 0 ; if ( LOG . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) ; } // create index CreateIndex create = new CreateIndex ( getTransactionId ( ) , null ) ; executeAndLog ( create ) ; // commit volatile index executeAndLog ( new VolatileCommit ( getTransactionId ( ) , create . getIndexName ( ) ) ) ; // add new index AddIndex add = new AddIndex ( getTransactionId ( ) , create . getIndexName ( ) ) ; executeAndLog ( add ) ; // create new volatile index resetVolatileIndex ( ) ; if ( LOG . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) - time ; LOG . debug ( "Committed in-memory index in " + time + "ms." ) ; } } }
Commits the volatile index to a persistent index . The new persistent index is added to the list of indexes but not written to disk . When this method returns a new volatile index has been created .