final synchronized LockingTaskMonitor lockForSnapshot(DomainObjectAdapterDB domainObj,
			boolean hasProgress, String title) {
		if (SystemUtilities.isInHeadlessMode()) {
			Msg.warn(this, "Snapshot not supported in headless mode");
			return null;
		}
		checkDomainObject(domainObj);
		if (lockCount != 0 || getCurrentTransactionInfo() != null || lockingTaskMonitor != null) {
			return null;
		}
		++lockCount; // prevent prepareToSave
		try {
			if (lock("snapshot")) {
				lockingTaskMonitor = new LockingTaskMonitor(domainObj, hasProgress, title);
				return lockingTaskMonitor;
			}
		}
		finally {
			--lockCount;
		}
		return null;
	}
Attempt to obtain a modification lock on the domain object when generating a
background snapshot.
@param domainObj domain object corresponding to snapshot
@param hasProgress true if monitor has progress indicator
@param title title to be used for monitor
@return monitor object if lock obtained successfully, else null which indicates that a
modification is in process.
Ghidra/Framework/Project/src/main/java/ghidra/framework/data/AbstractTransactionManager.java