You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/11/09 21:44:21 UTC

cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/naming/memory MemoryInitialContextFactory.java

donaldp     01/11/09 12:44:21

  Modified:    src/java/org/apache/avalon/excalibur/naming/memory
                        MemoryInitialContextFactory.java
  Log:
  Add more javadoc describing why MemoryInitialContextFactory should never be used in a real system and how to go about creating your own factory.
  
  Revision  Changes    Path
  1.2       +25 -0     jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/naming/memory/MemoryInitialContextFactory.java
  
  Index: MemoryInitialContextFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/naming/memory/MemoryInitialContextFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryInitialContextFactory.java	2001/08/08 14:26:28	1.1
  +++ MemoryInitialContextFactory.java	2001/11/09 20:44:21	1.2
  @@ -18,8 +18,33 @@
   /**
    * Initial context factory for memorycontext.
    *
  + * <p><b>WARNING:</b> This class should never be use used in a real
  + * system. It is is just a class that demonstrates how to write a
  + * basic <code>InitialContextFactory</code> for MemeoryContext.
  + * However this factory creates a new Context every time which is 
  + * rarely desired behaviour.</p>
  + *
  + * <p>In a real application you may want the policy of Context 
  + * creation to be specific application. Some strategies include.</p>
  + * <ul>
  + *   <li>ClassLoader-wide. ie Every user who is in same ClassLoader
  + *       or loaded from a Child ClassLoader will see same JNDI tree.
  + *       In this case the InitialContextFactory should cache root
  + *       context in a static variable.</li>
  + *   <li>Thread-specific. ie Give out initial context based on which
  + *       thread the caller is in. In this case the InitialContextFactory 
  + *       should cache root context in a [Inheritable]ThreadLocal 
  + *       variable.</li>
  + *   <li>Parameter-specific. ie Give out initial context based on 
  + *       a parameter passed in. The parameter could be passed in as 
  + *       PROVIDER_URL or another standard context property. In this 
  + *       case the InitialContextFactory should cache root context(s) 
  + *       in a static map variable that maps between parameter and 
  + *       context.</li>
  + * </ul>
  + *
    * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public class MemoryInitialContextFactory
       implements InitialContextFactory
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>