<commit_before>package org.lightmare.ejb.meta;

import static org.lightmare.jpa.JPAManager.closeEntityManagerFactories;

import java.io.IOException;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import javax.persistence.EntityManagerFactory;

import org.lightmare.jpa.JPAManager;

/**
 * Container class to save {@link MetaData} for bean interface {@link Class} and
 * connections {@link EntityManagerFactory}es for unit names
 * 
 * @author Levan
 * 
 */
public class MetaContainer {

	private static ConcurrentMap<String, MetaData> ejbs = new ConcurrentHashMap<String, MetaData>();

	public static MetaData addMetaData(String beanName, MetaData metaData) {
		return ejbs.putIfAbsent(beanName, metaData);
	}

	public static boolean checkMetaData(String beanName) {
		boolean check;
		MetaData metaData = ejbs.get(beanName);
		check = metaData == null;
		if (!check) {
			synchronized (metaData) {
				check = metaData.isInProgress();
			}
		}
		return check;
	}

	public boolean checkBean(String beanName) {
		return ejbs.containsKey(beanName);
	}

	public static MetaData getMetaData(String beanName) {
		return ejbs.get(beanName);
	}

	public static void removeMeta(String beanName) {
		ejbs.remove(beanName);
	}

	public static EntityManagerFactory getConnection(String unitName) throws IOException {
		return JPAManager.getConnection(unitName);
	}

	public static void closeConnections() {
		closeEntityManagerFactories();
	}

	public static Iterator<MetaData> getBeanClasses() {
		return ejbs.values().iterator();
	}
}<commit_msg>added comments to MetaContainer class fields<commit_after>package org.lightmare.ejb.meta;

import static org.lightmare.jpa.JPAManager.closeEntityManagerFactories;

import java.io.IOException;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import javax.persistence.EntityManagerFactory;

import org.lightmare.jpa.JPAManager;

/**
 * Container class to save {@link MetaData} for bean interface {@link Class} and
 * connections {@link EntityManagerFactory}es for unit names
 * 
 * @author Levan
 * 
 */
public class MetaContainer {

	// Cached bean meta data
	private static final ConcurrentMap<String, MetaData> EJBS = new ConcurrentHashMap<String, MetaData>();

	public static MetaData addMetaData(String beanName, MetaData metaData) {
		return EJBS.putIfAbsent(beanName, metaData);
	}

	public static boolean checkMetaData(String beanName) {
		boolean check;
		MetaData metaData = EJBS.get(beanName);
		check = metaData == null;
		if (!check) {
			synchronized (metaData) {
				check = metaData.isInProgress();
			}
		}
		return check;
	}

	public boolean checkBean(String beanName) {
		return EJBS.containsKey(beanName);
	}

	public static MetaData getMetaData(String beanName) {
		return EJBS.get(beanName);
	}

	public static void removeMeta(String beanName) {
		EJBS.remove(beanName);
	}

	public static EntityManagerFactory getConnection(String unitName)
			throws IOException {
		return JPAManager.getConnection(unitName);
	}

	public static void closeConnections() {
		closeEntityManagerFactories();
	}

	public static Iterator<MetaData> getBeanClasses() {
		return EJBS.values().iterator();
	}
}
{'fraction_non_alphanumeric': 0.09567336989640463, 'fraction_numerical': 0.0, 'mean_word_length': 5.125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '133357', 'n_tokens_mistral': 1035, 'n_tokens_neox': 991, 'n_words': 246}