Save This Page
Home » jboss-5.0.0.CR1-src » org.jboss.blocks » ejb » [javadoc | source]
org.jboss.blocks.ejb
public class: EJBHomeFactory [javadoc | source]
java.lang.Object
   org.jboss.blocks.ejb.EJBHomeFactory
An EJBHome factory. Abstracts EJBHome lookup and provides an instance cache to avoid JNDI overhead.

Concurrency

This class is not thread-safe. Use #makeSynchronized to obtain a thread-safe object.

Field Summary
protected final  Map cache    The cached EJBHome objects.
    todo: Use - a CachedMap backed by a HashMap so that the VM can reclaim these references when it needs memory.
 
protected final  Hashtable environment    The enviroment to use when constructing an InitialContext, or null if a plain context should be created. 
protected final  String prefix    An optional prefix which will be prepended to JNDI names for EJBHome lookup. 
Constructor:
 public EJBHomeFactory() 
 public EJBHomeFactory(Hashtable environment) 
    Construct a EJBHomeFactory using the given enviroment properties to construct an InitialContext.
    Parameters:
    environment - The environment properties used to create an InitialContext.
 public EJBHomeFactory(Hashtable environment,
    String prefix) 
    Construct a EJBHomeFactory using the given enviroment properties to construct an InitialContext and a JNDI prefix.
    Parameters:
    environment - The environment properties used to create an InitialContext.
    prefix - A JNDI prefix to prepend to JNDI names.
Method from org.jboss.blocks.ejb.EJBHomeFactory Summary:
create,   create,   create,   createInitialContext,   getInstance,   getPrefix,   invalidate,   invalidate,   invalidate,   lookupHome,   makeSynchronized
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.blocks.ejb.EJBHomeFactory Detail:
 public EJBHome create(String name) throws NamingException 
    Lookup an EJBHome object and return it.

    Returns a cached copy of the home object if there is one, else a new home object will be looked up from JNDI and added to the cache.

 public EJBHome create(Class type) throws NamingException 
    Lookup an EJBHome object and return it.
 public EJBHome create(String name,
    Class type) throws NamingException 
 protected InitialContext createInitialContext() throws NamingException 
    Create a new InitialContext object for JNDI lookups.
 public static synchronized EJBHomeFactory getInstance() 
    Returns the global instance of the EJBHome factory.

    The instance will be lazily initialized on the first invocation. Since many different threads may be accessing this object at same time, a synchronized factory is created.

 public String getPrefix() 
    Return the JNDI prefix, or null if not used.
 public  void invalidate() 
    Invalidate all cached home refernces.
 public  void invalidate(String name) 
    Invalidate the cached home for the given name, if there is one.
 public  void invalidate(Class type) 
    Invalidate the cached home for the given name, if there is one.
 protected EJBHome lookupHome(String name) throws NamingException 
    Lookup an EJBHome object from JNDI.
 public static EJBHomeFactory makeSynchronized(EJBHomeFactory aFactory) 
    Make a synchronized EJBHomeFactory.