Class JndiDestinationResolver
- All Implemented Interfaces:
- CachingDestinationResolver,- DestinationResolver
DestinationResolver implementation which interprets destination names
 as JNDI locations (with a configurable fallback strategy).
 Allows for customizing the JNDI environment if necessary, for example specifying appropriate JNDI environment properties.
Dynamic queues and topics get cached by destination name. As a consequence,
 you need to use unique destination names across both queues and topics.
 Caching can be turned off through the "cache" flag.
 
Note that the fallback to resolution of dynamic destinations
 is turned off by default. Switch the
 "fallbackToDynamicDestination"
 flag on to enable this functionality.
- Since:
- 1.1
- Author:
- Mark Pollack, Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class org.springframework.jndi.JndiLocatorSupportCONTAINER_PREFIXFields inherited from class org.springframework.jndi.JndiAccessorlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidClear the entire destination cache.voidremoveFromCache(String destinationName) Remove the destination with the given name from the cache (if cached by this resolver in the first place).resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) Resolve the given destination name, either as located resource or as dynamic destination.voidsetCache(boolean cache) Set whether to cache resolved destinations.voidsetDynamicDestinationResolver(DestinationResolver dynamicDestinationResolver) Set theDestinationResolverto use when falling back to dynamic destinations.voidsetFallbackToDynamicDestination(boolean fallbackToDynamicDestination) Set whether this resolver is supposed to create dynamic destinations if the destination name is not found in JNDI.protected voidvalidateDestination(Destination destination, String destinationName, boolean pubSubDomain) Validate the given Destination object, checking whether it matches the expected type.Methods inherited from class org.springframework.jndi.JndiLocatorSupportconvertJndiName, isResourceRef, lookup, lookup, setResourceRefMethods inherited from class org.springframework.jndi.JndiAccessorgetJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate
- 
Constructor Details- 
JndiDestinationResolverpublic JndiDestinationResolver()
 
- 
- 
Method Details- 
setCachepublic void setCache(boolean cache) Set whether to cache resolved destinations. Default is "true".This flag can be turned off to re-lookup a destination for each operation, which allows for hot restarting of destinations. This is mainly useful during development. Note that dynamic queues and topics get cached by destination name. As a consequence, you need to use unique destination names across both queues and topics. 
- 
setFallbackToDynamicDestinationpublic void setFallbackToDynamicDestination(boolean fallbackToDynamicDestination) Set whether this resolver is supposed to create dynamic destinations if the destination name is not found in JNDI. Default is "false".Turn this flag on to enable transparent fallback to dynamic destinations. 
- 
setDynamicDestinationResolverSet theDestinationResolverto use when falling back to dynamic destinations.The default is Spring's standard DynamicDestinationResolver.
- 
resolveDestinationNamepublic Destination resolveDestinationName(@Nullable Session session, String destinationName, boolean pubSubDomain) throws JMSException Description copied from interface:DestinationResolverResolve the given destination name, either as located resource or as dynamic destination.- Specified by:
- resolveDestinationNamein interface- DestinationResolver
- Parameters:
- session- the current JMS Session (may be- nullif the resolver implementation is able to work without it)
- destinationName- the name of the destination
- pubSubDomain-- trueif the domain is pub-sub,- falseif P2P
- Returns:
- the JMS destination (either a topic or a queue)
- Throws:
- JMSException- if the JMS Session failed to resolve the destination
 
- 
validateDestinationprotected void validateDestination(Destination destination, String destinationName, boolean pubSubDomain) Validate the given Destination object, checking whether it matches the expected type.- Parameters:
- destination- the Destination object to validate
- destinationName- the name of the destination
- pubSubDomain-- trueif a Topic is expected,- falsein case of a Queue
 
- 
removeFromCacheDescription copied from interface:CachingDestinationResolverRemove the destination with the given name from the cache (if cached by this resolver in the first place).To be called if access to the specified destination failed, assuming that the JMS Destination object might have become invalid. - Specified by:
- removeFromCachein interface- CachingDestinationResolver
- Parameters:
- destinationName- the name of the destination
 
- 
clearCachepublic void clearCache()Description copied from interface:CachingDestinationResolverClear the entire destination cache.To be called in case of general JMS provider failure. - Specified by:
- clearCachein interface- CachingDestinationResolver
 
 
-