public void commit() {
		if (useSerializableTransactions && getTransactionContext().nested != 0) {
			// Store should not be used in serializable transaction mode
			throw new StorageError(StorageError.INVALID_OPERATION, "commit");
		}

		synchronized (backgroundGcMonitor) {
			synchronized (this) {
				if (!opened) {
					throw new StorageError(StorageError.STORAGE_NOT_OPENED);
				}

				if (!modified) {
					return;
				}

				objectCache.flush();

				if (customAllocatorList != null) {
					Iterator iterator = customAllocatorList.iterator();

					while (iterator.hasNext()) {
						CustomAllocator alloc = (CustomAllocator) iterator
								.next();

						if (alloc.isModified()) {
							alloc.store();
						}

						alloc.commit();
					}
				}

				commit0();
				modified = false;
			}
		}
	}