Class CachedJndiNameResolver
java.lang.Object
org.mule.jms.commons.api.connection.factory.jndi.CachedJndiNameResolver
- All Implemented Interfaces:
JndiNameResolver,org.mule.runtime.api.lifecycle.Disposable,org.mule.runtime.api.lifecycle.Initialisable,org.mule.runtime.api.lifecycle.Lifecycle,org.mule.runtime.api.lifecycle.Startable,org.mule.runtime.api.lifecycle.Stoppable
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.- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.slf4j.LoggerFields inherited from interface org.mule.runtime.api.lifecycle.Disposable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Initialisable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Startable
PHASE_NAMEFields inherited from interface org.mule.runtime.api.lifecycle.Stoppable
PHASE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ContextCreates a JNDI context using the currentcontextFactoryvoiddispose()protected HashtablevoidLooks up an object by name.voidsetContextFactory(InitialContextFactory contextFactory) voidsetJndiInitialFactory(String jndiInitialFactory) voidsetJndiProviderProperties(Map<String, Object> jndiProviderProperties) voidsetJndiProviderUrl(String jndiProviderUrl) voidstart()voidstop()
-
Field Details
-
cache
-
LOGGER
protected final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
CachedJndiNameResolver
public CachedJndiNameResolver()
-
-
Method Details
-
lookup
Description copied from interface:JndiNameResolverLooks 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()- Specified by:
initialisein interfaceorg.mule.runtime.api.lifecycle.Initialisable
-
stop
public void stop() throws org.mule.runtime.api.exception.MuleExceptionCleans up the cache.- Specified by:
stopin interfaceorg.mule.runtime.api.lifecycle.Stoppable- Throws:
org.mule.runtime.api.exception.MuleException
-
createInitialContext
Creates a JNDI context using the currentcontextFactory- Returns:
- a new
Contextinstance. Callers must provide concurrent access control on the returned value. - Throws:
NamingException- if there is a problem during the context creation.
-
getContextProperties
-
getJndiProviderUrl
-
setJndiProviderUrl
-
getJndiInitialFactory
-
setJndiInitialFactory
-
getJndiProviderProperties
-
setJndiProviderProperties
-
getContextFactory
-
setContextFactory
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.mule.runtime.api.lifecycle.Disposable
-
start
public void start() throws org.mule.runtime.api.exception.MuleException- Specified by:
startin interfaceorg.mule.runtime.api.lifecycle.Startable- Throws:
org.mule.runtime.api.exception.MuleException
-