private Program openURL(ProgramLocator locator, TaskMonitor monitor) {
		URL ghidraUrl = locator.getURL();

		AtomicReference<Program> openedProgram = new AtomicReference<>();
		try {
			GhidraURLQuery.queryUrl(ghidraUrl, new GhidraURLResultHandlerAdapter() {
				@Override
				public void processResult(DomainFile domainFile, URL url, TaskMonitor m) {
					Program p = openProgram(locator, domainFile, m);  // may return null
					openedProgram.set(p);
				}
			}, monitor);
		}
		catch (IOException | CancelledException e) {
			// IOException reported to user by GhidraURLResultHandlerAdapter
			return null;
		}
		return openedProgram.get();
	}
Opens the program for the given location.
This method is intended to be invoked from within a {@link Task} or for headless operations. 
@param locator the program location to open
@param monitor the TaskMonitor used for status and cancelling
@return the opened program or null if the operation failed or was cancelled
Ghidra/Features/Base/src/main/java/ghidra/app/util/task/ProgramOpener.java