equal
deleted
inserted
replaced
|
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 } |