docs: public synchronized void flush()
                      throws ObjectManagerException
      {
          final String methodName = "flush";
          if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
              trace.entry(this,
                          cclass,
                          methodName);
  
          if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
              // Since we only flush on shutdown make sure we are shutting down, otherwise just return. 
              if (objectManagerState.getObjectManagerStateState() != ObjectManagerState.stateStopped) {
                  if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                      trace.exit(this,
                                 cclass,
                                 methodName);
                  return;
              }
  
              // If there are any active transactions it is not safe to flush.
              if (objectManagerState.getTransactionIterator().hasNext()) {
                  trace.warning(this,
                                cclass,
                                methodName,
                                "ObjectStore_UnsafeToFlush",
                                this
                                  );
                  if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                      trace.exit(this,
                                 cclass,
                                 methodName);
                  return;
              }
          } // if ( storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN ).
  
          // Debug freespace list
          // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: newFreeSpace.size()      = "+newFreeSpace.size());
          // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
  
          // We are single threaded through flush, we are now about to make
          // updates to the directory and free space map, which must be consistent.
          // Also reserve space in the file for the directory updates and free space map.
          updateDirectory();
  
          // Release any space into the free space pool.
          if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
              trace.debug(this,
                          cclass,
                          methodName,
                          "Release new free space");
  
          // Free up space that was release by directory changes, replaced or deleted Objects.
          freeAllocatedSpace(newFreeSpace);
  
          if (gatherStatistics) {
              long now = System.currentTimeMillis();
              releasingEntrySpaceMilliseconds += now - lastFlushMilliseconds;
              lastFlushMilliseconds = now;
          } // if (gatherStatistics).
  
          // Write the modified parts of the directory to disk.
          directory.write();
  
          if (gatherStatistics) {
              long now = System.currentTimeMillis();
              directoryWriteMilliseconds += now - lastFlushMilliseconds;
              lastFlushMilliseconds = now;
          } // if (gatherStatistics).
  
          // Write the free space map to disk.
          writeFreeSpace();
  
          // Force the data to disk then force the header, if we can make the assumption that
          // these writes go to disk first, this first force is unnecessary.
          if (storeStrategy == STRATEGY_KEEP_ALWAYS)
              force();
  
          writeHeader();
          if (storeStrategy == STRATEGY_KEEP_ALWAYS)
              force();
  
          // Debug freespace list
          // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: newFreeSpace.size()      = "+newFreeSpace.size());
          // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
  
          // Defect 573905
          // Reset the newFreeSpace after we have finished with it to release the
          // memory it uses while we are not flushing.
          newFreeSpace.clear();
  
          if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
              trace.exit(this,
                         cclass,
                         methodName);
      }