Writes current changes to disk and flushes modified objects in the
        AAFObjectManager
332936
def save(self):
        
        if self.mode in ("wb+", 'rb+'):
            if not self.is_open:
                raise IOError("file closed")
            self.write_reference_properties()
            self.manager.write_objects()
1228134
@Override
    public void update(Number obj) {
        if (enable == false) {
            return;
        }

        if (intervalCheck.check()) {
            flush();
        }
        synchronized (this) {
            unflushed = updater.update(obj, unflushed);
        }
    }
786303
def flush(self):
        """"""
        self._check_open_file()
        if self.allow_update and not self.is_stream:
            contents = self._io.getvalue()
            if self._append:
                self._sync_io()
                old_contents = (self.file_object.byte_contents
                                if is_byte_string(contents) else
                                self.file_object.contents)
                contents = old_contents + contents[self._flush_pos:]
                self._set_stream_contents(contents)
                self.update_flush_pos()
            else:
                self._io.flush()
            if self.file_object.set_contents(contents, self._encoding):
                if self._filesystem.is_windows_fs:
                    self._changed = True
                else:
                    current_time = time.time()
                    self.file_object.st_ctime = current_time
                    self.file_object.st_mtime = current_time
            self._file_epoch = self.file_object.epoch

            if not self.is_stream:
                self._flush_related_files()
1232177
synchronized void cleanUp() {

        updateAccessCounts();

        int                          removeCount = size() / 2;
        int accessTarget = getAccessCountCeiling(removeCount, removeCount / 8);
        BaseHashMap.BaseHashIterator it          = new BaseHashIterator();
        int                          savecount   = 0;

        for (; it.hasNext(); ) {
            CachedObject r = (CachedObject) it.next();

            if (it.getAccessCount() <= accessTarget) {
                synchronized (r) {
                    if (!r.isKeepInMemory()) {
                        r.setInMemory(false);

                        if (r.hasChanged()) {
                            rowTable[savecount++] = r;
                        }

                        it.remove();

                        cacheBytesLength -= r.getStorageSize();

                        removeCount--;
                    }
                }
            }
        }

        if (removeCount > 50) {
            it = new BaseHashIterator();

            for (; removeCount >= 0 && it.hasNext(); ) {
                CachedObject r = (CachedObject) it.next();

                if (!r.isKeepInMemory()) {
                    r.setInMemory(false);

                    if (r.hasChanged()) {
                        rowTable[savecount++] = r;
                    }

                    it.remove();

                    cacheBytesLength -= r.getStorageSize();

                    removeCount--;
                }
            }
        }

        super.setAccessCountFloor(accessTarget);
        saveRows(savecount);
    }
414219
public synchronized void save() {
        SharedPreferences prefs = loadSharedPreferences("object");

        if (find(getId()) == null) {
            addObject();

            modelListenerHandler.execOnUpdateListeners(this, OnUpdateListener.Status.CREATED);

            if (cache && cachedObjects != null) {
                cachedObjects.add((T) this);
            }
        } else {
            modelListenerHandler.execOnUpdateListeners(this, OnUpdateListener.Status.UPDATED);
        }

        prefs.edit().putString(String.valueOf(getId()), toJson().toString()).commit();
    }
211657
def set_dirty_and_flush_changes(non_const_func):
    """"""

    def flush_changes(self, *args, **kwargs):
        rval = non_const_func(self, *args, **kwargs)
        self._dirty = True
        self.write()
        return rval
    # END wrapper method
    flush_changes.__name__ = non_const_func.__name__
    return flush_changes
62415
protected void flushObjects ()
    {
        long now = System.currentTimeMillis();
        for (Iterator<IntMap.IntEntry<FlushRecord>> iter = _flushes.intEntrySet().iterator();
             iter.hasNext(); ) {
            IntMap.IntEntry<FlushRecord> entry = iter.next();
//             int oid = entry.getIntKey();
            FlushRecord rec = entry.getValue();
            if (rec.expire <= now) {
                iter.remove();
                flushObject(rec.object);
//                 Log.info("Flushed object " + oid + ".");
            }
        }
    }
1290492
function flushCacheTimed(stream, onFlush) {
    var nextWrite = lastWrite + settings.time;
    var now = Date.now();

    // we are overdue for a write, so write now
    if (now >= nextWrite) {
      flushCache(stream);
      onFlush();

      return;
    }

    // write after the remainder between now and when
    // the next write should be according to milliseconds
    // and the previous write
    timeout = setTimeout(function () {
      flushCache(stream);
      onFlush();
    }, nextWrite - now);
  }
380422
def cache_write(obj)
      # This is just a safety check. It can probably be disabled in the future
      # to increase performance.
      if obj.respond_to?(:is_poxreference?)
        # If this condition triggers, we have a bug in the library.
        PEROBS.log.fatal "POXReference objects should never be cached"
      end

      if @transaction_stack.empty?
        # We are not in transaction mode.
        idx = index(obj)
        if (old_obj = @writes[idx]) && old_obj._id != obj._id
          # There is another old object using this cache slot. Before we can
          # re-use the slot, we need to sync it to the permanent storage.
          old_obj._sync
        end
        @writes[idx] = obj
      else
        # When a transaction is active, we don't have a write cache. The read
        # cache is used to speed up access to recently used objects.
        cache_read(obj)
        # Push the reference of the modified object into the write buffer for
        # this transaction level.
        unless @transaction_stack.last.include?(obj._id)
          @transaction_stack.last << obj._id
          @transaction_objects[obj._id] = obj
        end
      end
    end
67256
@Override
    public void flush() throws IOException {
        checkClosed();
        
        if (bs.isDirty()) {
            bs.write();
        }
        
        for (int i = 0; i < bs.getNrFats(); i++) {
            fat.writeCopy(bs.getFatOffset(i));
        }
        
        rootDir.flush();
        
        if (fsiSector != null) {
            fsiSector.setFreeClusterCount(fat.getFreeClusterCount());
            fsiSector.setLastAllocatedCluster(fat.getLastAllocatedCluster());
            fsiSector.write();
        }
    }
677857
public void flushSomeAvailableRowsFrom(final XMLUtil util, final Appendable appendable,
                                           final int rowIndex) throws IOException {
        this.appender.flushSomeAvailableRowsFrom(util, appendable, rowIndex);
    }
863967
private function flush()
    {
        foreach ($this->queue as $item) {
            $this->delegate->writeItem($item);
        }

        if ($this->delegate instanceof FlushableWriter) {
            $this->delegate->flush();
        }
    }
278770
final void write(ManagedObject managedObject)
                    throws ObjectManagerException
    {
        final String methodName = "write";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { managedObject });

        ObjectManagerByteArrayOutputStream byteArrayOutputStream = null;
        byte[] serializedBytes = null;
        int serializedBytesLength = 0;
        if (usesSerializedForm) {
            // Pick up and write the latest serialized bytes.

            // It is possible that several threads requested a write one after the
            // other each getting the request added to a different managedObjetsToWrite table,
            // however the first of these through here will clear serializedBytes.
            // It is also possible that the transaction state of the managed object
            // was restored from a checkpoint, in which case the serialized object
            // may already be in the ObjectStore, and the serializedBytes will again be null.

            // Is the Object deleted? It may have got deleted after we release the
            // synchronize lock when we captured the tokensToWrite hashtable but before we
            // actually try to write it. We dont strictly need the test for stateDeleted
            // since once in this state the byteArrayOutputStream will be null.
            if (managedObject.state != ManagedObject.stateDeleted)
                byteArrayOutputStream = managedObject.freeLatestSerializedBytes();

        } else {
            // Not logged so use the current serialized bytes, as long as its not part of a transaction.
            // If it is part of a transaction then the transaction will hold the ManagedObject in memory.
            // Not locked because this is only used by SAVE_ONLY_ON_SHUTDOWN stores at shutdown
            // when no appliaction threads are active.
            if (managedObject.state == ManagedObject.stateReady)
                byteArrayOutputStream = managedObject.getSerializedBytes();
            // The byteArrayOutputStream will have getRleaseSize() == 0;
        } // if ( usesSerializedForm ).

        if (byteArrayOutputStream != null) {
            serializedBytes = byteArrayOutputStream.getBuffer();
            serializedBytesLength = byteArrayOutputStream.getCount();
            // For debugging add guardBytes before and after the serialized
            // ManagedObject.
            if (useGuardBytes) {
                guardByte++;
                byte[] guardedBytes = new byte[guardBytesLength + serializedBytesLength + guardBytesLength];
                java.util.Arrays.fill(guardedBytes // Target
                                      , 0 // From index.
                                      , guardBytesLength - 1 // To index.
                                      , guardByte //Fill byte.
                );
                System.arraycopy(serializedBytes // Source.
                                 , 0 // Source position.
                                 , guardedBytes // Destination.
                                 , guardBytesLength // Destination position.
                                 , serializedBytesLength// Length.
                );
                java.util.Arrays.fill(guardedBytes,
                                      guardBytesLength + serializedBytesLength,
                                      guardBytesLength + serializedBytesLength + guardBytesLength - 1,
                                      guardByte);
                serializedBytes = guardedBytes;
                serializedBytesLength = guardedBytes.length;
            } // if (useGuardBytes).

            //TODO Consider Rounding to a 4K boundary.
            //!! int lengthRequired = ((serializedBytes.length/4096)+1)*4096;

            // Allocate some space for the ManagedObject, if we are recovering, we can reuse already 
            // allocated space and avoid the need to have extra space available in the store. This is 
            // important if we were to crash after flushing the store but before we write checkpoint 
            // end. It that event we would try and write the objects to the store for a second time
            // during recovery and require that it had enough spare space to do this. 
            Directory.StoreArea storeArea;
            boolean addToDirectory = false;
            if (objectManagerState.getObjectManagerStateState() == ObjectManagerState.stateReplayingLog) {
                storeArea = (Directory.StoreArea) directory.getEntry(new Long(managedObject.owningToken.storedObjectIdentifier));
                if (storeArea == null
                    || storeArea.length < serializedBytesLength
                    || storeArea.length + minimumFreeSpaceEntrySize > serializedBytesLength) {
                    FreeSpace freeSpace = allocateSpace(serializedBytesLength);
                    storeArea = (Directory.StoreArea) directory.makeStoreArea(managedObject.owningToken.storedObjectIdentifier,
                                                                              freeSpace.address,
                                                                              freeSpace.length);
                    addToDirectory = true;
                }

            } else {
                FreeSpace freeSpace = allocateSpace(serializedBytesLength);
                storeArea = (Directory.StoreArea) directory.makeStoreArea(managedObject.owningToken.storedObjectIdentifier,
                                                                          freeSpace.address,
                                                                          freeSpace.length);
                addToDirectory = true;
            } // if (objectManagerState.

            if (gatherStatistics)
                numberOfManagedObjectsWritten++;
            writeBuffer(serializedBytes,
                        0,
                        serializedBytesLength,
                        storeArea.byteAddress);

            if (addToDirectory) {
                // We assume that even though the buffer has not been forced to disk, the file system will
                // allow a read of the disk to look into the buffer, hence we go ahead and
                // update the live directory.
                Directory.StoreArea existingStoreArea = (Directory.StoreArea) directory.putEntry(storeArea);

                // If this is a replacement we will eventually recover the space the previous object occupies.
                // Note the free space for now but don't release it until the new Object
                // has been forced to disk.
                if (existingStoreArea != null) {
                    newFreeSpace.add(existingStoreArea);
                } // if (existingStoreArea == null).
            } // if (addToDirectory).

            // Keep count of the space we will eventually release now that we have allocated the space.
            checkpointReleaseSize = checkpointReleaseSize + byteArrayOutputStream.getReleaseSize();
            objectManagerState.returnByteArrayOutputStreamToPool(byteArrayOutputStream);
        } // if (byteArrayOutputStream != null ).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
178606
private final void flushBuffer() throws IOException {
		if (bufOutput.position() > 0) {
			bufOutput.flip();
			fcOutput.write(bufOutput);
			bufOutput.clear();
			// log.debug("offsetOutputUncommited=" + offsetOutputUncommited + " offsetOutputCommited=" +
			// offsetOutputCommited + " fcOutput.position()=" + fcOutput.position());
			offsetOutputUncommited = offsetOutputCommited = fcOutput.position();
			if (syncOnFlush) {
				fcOutput.force(false);
				if (callback != null) {
					callback.synched(offsetOutputCommited);
				}
			}
		}
	}
1217101
def flush(self):
        
        for key in self.grouping_info.keys():
            if self._should_flush(key):
                self._write_current_buffer_for_group_key(key)
264790
public synchronized void flush()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
            trace.entry(this,
                        cclass,
                        "flush");
            trace.exit(this,
                       cclass,
                       "flush");
        }
    }
183564
public void update(Object object) {
        try {
            persistenceManager.saveEntity((IManagedEntity) object);
        } catch (InitializationException ignore){}
        catch (Exception e) {
            e.printStackTrace();
        }
    }