<commit_before>package com.BibleQuote.managers;

import com.BibleQuote.exceptions.OpenModuleException;
import com.BibleQuote.models.Module;
import com.BibleQuote.utils.Log;
import com.BibleQuote.utils.Task;

public class AsyncOpenModule extends Task {
	private final String TAG = "AsyncOpenModule";
	
	private Librarian librarian;
	private Module nextClosedModule = null;
	private Boolean isReload = false;
	private Exception exception;
	private Boolean isSuccess;
	
	public AsyncOpenModule(String message, Boolean isHidden, Librarian librarian, Boolean isReload) {
		super(message, isHidden);
		this.librarian = librarian;
		this.isReload = isReload;
	}

	
	@Override
	protected Boolean doInBackground(String... arg0) {
		isSuccess = false;
		if (isReload) {
			librarian.loadModules();
			isReload = false;
		}
		Module module = librarian.getClosedModule();
		if (module != null) {
			Log.i(TAG, String.format("Open module with moduleID=%1$s", module.getID()));
		try {
			module = librarian.openModule(module.getID(), module.getDataSourceID());
		} catch (OpenModuleException e) {
			module.setIsClosed(true);
			exception = e;
		}
			nextClosedModule = librarian.getClosedModule();
		}
		isSuccess = true;
		return true;
	}
	
	
	@Override
	protected void onPostExecute(Boolean result) {
		super.onPostExecute(result);
	}

	public Exception getException() {
		return exception;
	}

	public Boolean isSuccess() {
		return isSuccess;
	}
	
	public Module getNextClosedModule() {
		return nextClosedModule;
	}
}<commit_msg>Foreground loading of modules<commit_after>package com.BibleQuote.managers;

import com.BibleQuote.exceptions.OpenModuleException;
import com.BibleQuote.models.Module;
import com.BibleQuote.utils.Log;
import com.BibleQuote.utils.Task;

public class AsyncOpenModule extends Task {
	private final String TAG = "AsyncOpenModule";
	
	private Librarian librarian;
	private Module nextClosedModule = null;
	private Boolean isReload = false;
	private Exception exception;
	private Boolean isSuccess;
	
	public AsyncOpenModule(String message, Boolean isHidden, Librarian librarian, Boolean isReload) {
		super(message, isHidden);
		this.librarian = librarian;
		this.isReload = isReload;
	}

	
	@Override
	protected Boolean doInBackground(String... arg0) {
		isSuccess = false;
		try {
			if (isReload) {
				librarian.loadModules();
				isReload = false;
			}
			Module module = librarian.getClosedModule();
			if (module != null) {
				Log.i(TAG, String.format("Open module with moduleID=%1$s", module.getID()));
				module = librarian.openModule(module.getID(), module.getDataSourceID());
				nextClosedModule = librarian.getClosedModule();
			}
			isSuccess = true;
		} catch (OpenModuleException e) {
			//Log.e(TAG, String.format("doInBackground(): %1$s", e.toString()), e);
			exception = e;
		}
		return true;
	}
	
	
	@Override
	protected void onPostExecute(Boolean result) {
		super.onPostExecute(result);
	}

	public Exception getException() {
		return exception;
	}

	public Boolean isSuccess() {
		return isSuccess;
	}
	
	public Module getNextClosedModule() {
		return nextClosedModule;
	}
}
{'fraction_non_alphanumeric': 0.10587102983638114, 'fraction_numerical': 0.0016041065126724415, 'mean_word_length': 4.51858407079646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '407941', 'n_tokens_mistral': 1099, 'n_tokens_neox': 961, 'n_words': 233}