1 package nl.tudelft.simulation.naming.context;
2
3 import java.util.Hashtable;
4
5 /**
6 * A factory for JvmContext instances, automatically invoked by JNDI when the correct jndi.properties file has been used.
7 * <p>
8 * Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
9 * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
10 * project is distributed under a three-clause BSD-style license, which can be found at
11 * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
12 * </p>
13 * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
14 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
15 */
16 public class JvmContextFactory implements ContextFactory
17 {
18 /** context refers to the static JvmContext. */
19 private static JvmContext context = null;
20
21 @Override
22 public synchronized ContextInterface getInitialContext(final Hashtable<?, ?> environment, final String atomicName)
23 {
24 if (context == null)
25 {
26 JvmContextFactory.context = new JvmContext(atomicName);
27 }
28 return context;
29 }
30 }