org.mule.transport.jms.jndi
Class CachedJndiNameResolver

java.lang.Object
  extended by org.mule.transport.jms.jndi.AbstractJndiNameResolver
      extended by org.mule.transport.jms.jndi.CachedJndiNameResolver
All Implemented Interfaces:
Disposable, Initialisable, Lifecycle, Startable, Stoppable, JndiNameResolver

public class CachedJndiNameResolver
extends AbstractJndiNameResolver

Defines a JndiNameResolver that uses a cache in order to store the already resolved names.

The cache does not have an automated mechanism for cleaning up the data. In case of getting corrupt data, a way to cleaning up the cache is to stop and then restart the instance.


Field Summary
protected  Map<String,Object> cache
           
 
Fields inherited from class org.mule.transport.jms.jndi.AbstractJndiNameResolver
logger
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
CachedJndiNameResolver()
           
 
Method Summary
 void initialise()
          Method used to perform any initialisation work.
 Object lookup(String name)
          Looks up an object by name.
 void stop()
          

Cleans up the cache.

 
Methods inherited from class org.mule.transport.jms.jndi.AbstractJndiNameResolver
createInitialContext, dispose, getContextFactory, getContextProperties, getJndiInitialFactory, getJndiProviderProperties, getJndiProviderUrl, setContextFactory, setJndiInitialFactory, setJndiProviderProperties, setJndiProviderUrl, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected Map<String,Object> cache
Constructor Detail

CachedJndiNameResolver

public CachedJndiNameResolver()
Method Detail

lookup

public Object lookup(String name)
              throws NamingException
Description copied from interface: JndiNameResolver
Looks up an object by name.

Parameters:
name - the name of the object to search for
Returns:
the object if is found
Throws:
NamingException - is there is an error during the lookup.

initialise

public void initialise()
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Overrides:
initialise in class AbstractJndiNameResolver

stop

public void stop()
          throws MuleException

Cleans up the cache.

Specified by:
stop in interface Stoppable
Overrides:
stop in class AbstractJndiNameResolver
Throws:
MuleException


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.