code: public void flush() throws IOException
     {
        SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
        {
           public Void run() throws Exception
           {
              synchronized (MultiIndex.this)
              {
                 // commit volatile index
                 executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
                 commitVolatileIndex();
  
                 // commit persistent indexes
                 for (int i = indexes.size() - 1; i >= 0; i--)
                 {
                    PersistentIndex index = indexes.get(i);
                    // only commit indexes we own
                    // index merger also places PersistentIndex instances in
                    // indexes,
                    // but does not make them public by registering the name in
                    // indexNames
                    if (indexNames.contains(index.getName()))
                    {
                       index.commit();
                       // check if index still contains documents
                       if (index.getNumDocuments() == 0)
                       {
                          executeAndLog(new DeleteIndex(getTransactionId(), index.getName()));
                       }
                    }
                 }
                 executeAndLog(new Commit(getTransactionId()));
  
                 indexNames.write();
  
                 // reset redo log
                 redoLog.clear();
  
                 lastFlushTime = System.currentTimeMillis();
                 lastFileSystemFlushTime = System.currentTimeMillis();
              }
  
              // delete obsolete indexes
              attemptDelete();
              return null;
           }
        });
     }
docs: Flushes this <code>MultiIndex</code>. Persists all pending changes and
  resets the redo log.
  
  @throws IOException
  if the flush fails.