diff -r 452e65d696a3 -r f692598b3742 src/main/java/ru/indvdum/jpa/jndi/SimpleContextFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ru/indvdum/jpa/jndi/SimpleContextFactory.java Fri Nov 09 03:00:49 2012 +0400 @@ -0,0 +1,28 @@ +package ru.indvdum.jpa.jndi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.spi.InitialContextFactory; + +/** + * @author indvdum (gotoindvdum[at]gmail[dot]com) + * @since 03.11.2011 16:37:21 + * + */ +public class SimpleContextFactory implements InitialContextFactory { + + private static Context simpleContext = null; + + @Override + public Context getInitialContext(Hashtable environment) throws NamingException { + if (simpleContext == null) { + synchronized (this) { + simpleContext = new SimpleContext(environment); + } + } + + return simpleContext; + } +} \ No newline at end of file