src/main/java/ru/indvdum/jpa/jndi/SimpleContextFactory.java
author indvdum (gotoindvdum[at]gmail[dot]com)
Thu, 20 Dec 2012 19:59:53 +0400
changeset 19 39381427da3f
parent 2 f692598b3742
permissions -rw-r--r--
Method read() added
     1 package ru.indvdum.jpa.jndi;
     2 
     3 import java.util.Hashtable;
     4 
     5 import javax.naming.Context;
     6 import javax.naming.NamingException;
     7 import javax.naming.spi.InitialContextFactory;
     8 
     9 /**
    10  * @author indvdum (gotoindvdum[at]gmail[dot]com)
    11  * @since 03.11.2011 16:37:21
    12  * 
    13  */
    14 public class SimpleContextFactory implements InitialContextFactory {
    15 
    16 	private static Context simpleContext = null;
    17 
    18 	@Override
    19 	public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
    20 		if (simpleContext == null) {
    21 			synchronized (this) {
    22 				simpleContext = new SimpleContext(environment);
    23 			}
    24 		}
    25 
    26 		return simpleContext;
    27 	}
    28 }