<commit_before>package org.lightmare.jndi;

import java.util.Hashtable;

import javax.naming.NamingException;
import javax.persistence.EntityManagerFactory;

import org.lightmare.jpa.JPAManager;
import org.osjava.sj.memory.MemoryContext;

public class DSContext extends MemoryContext {

	public DSContext(Hashtable<?, ?> env) {
		super(env);
	}

	@Override
	public Object lookup(String name) throws NamingException {

		// Checks if connection is in progress and waits for finish
		JPAManager.isInProgress(name);

		// Gets EntityManagerFactory from parent
		EntityManagerFactory emf = (EntityManagerFactory) super.lookup(name);

		return emf.createEntityManager();
	}<commit_msg>improvements in simple jndi for distinguish connections and general java objects<commit_after>package org.lightmare.jndi;

import java.util.Hashtable;

import javax.naming.NamingException;
import javax.persistence.EntityManagerFactory;

import org.lightmare.jpa.JPAManager;
import org.osjava.sj.memory.MemoryContext;

public class DSContext extends MemoryContext {

	public DSContext(Hashtable<?, ?> env) {
		super(env);
	}

	@Override
	public Object lookup(String name) throws NamingException {

		Object value;
		if (name.startsWith("java:comp/env/")) {

			// Checks if connection is in progress and waits for finish
			JPAManager.isInProgress(name);

			// Gets EntityManagerFactory from parent
			EntityManagerFactory emf = (EntityManagerFactory) super
					.lookup(name);

			value = emf.createEntityManager();
		} else {
			value = super.lookup(name);
		}

		return value;
	}
{'fraction_non_alphanumeric': 0.09218950064020487, 'fraction_numerical': 0.0, 'mean_word_length': 4.87593984962406, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1880447', 'n_tokens_mistral': 506, 'n_tokens_neox': 467, 'n_words': 118}