|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jndi.JndiAccessor org.springframework.jndi.JndiLocatorSupport org.springframework.jms.support.destination.JndiDestinationResolver
public class JndiDestinationResolver
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.
Thus, use unique destination names across both queues and topics.
Caching can be turned off by specifying cache
as false
.
Please note that the fallback to resolution of dynamic destinations is turned
off by default. Specify
fallbackToDynamicDestination
as
true
to enable this functionality.
JndiAccessor.setJndiTemplate(org.springframework.jndi.JndiTemplate)
,
JndiAccessor.setJndiEnvironment(java.util.Properties)
,
setCache(boolean)
,
setFallbackToDynamicDestination(boolean)
Field Summary |
---|
Fields inherited from class org.springframework.jndi.JndiLocatorSupport |
---|
CONTAINER_PREFIX |
Fields inherited from class org.springframework.jndi.JndiAccessor |
---|
logger |
Constructor Summary | |
---|---|
JndiDestinationResolver()
|
Method Summary | |
---|---|
void |
clearCache()
Clear the entire destination cache. |
void |
removeFromCache(String destinationName)
Remove the destination with the given name from the cache (if cached by this resolver in the first place). |
Destination |
resolveDestinationName(Session session,
String destinationName,
boolean pubSubDomain)
Resolve the given destination name, either as located resource or as dynamic destination. |
void |
setCache(boolean cache)
Set whether to cache resolved destinations. |
void |
setDynamicDestinationResolver(DestinationResolver dynamicDestinationResolver)
Set the DestinationResolver to use when falling back to dynamic
destinations. |
void |
setFallbackToDynamicDestination(boolean fallbackToDynamicDestination)
Set the ability of JndiDestinationResolver to create dynamic destinations
if the destination name is not found in JNDI. |
protected void |
validateDestination(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.JndiLocatorSupport |
---|
convertJndiName, isResourceRef, lookup, lookup, setResourceRef |
Methods inherited from class org.springframework.jndi.JndiAccessor |
---|
getJndiEnvironment, getJndiTemplate, setJndiEnvironment, setJndiTemplate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JndiDestinationResolver()
Method Detail |
---|
public void setCache(boolean cache)
true
.
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.
Please note that dynamic queues and topics get cached by destination name. Thus, use unique destination names across both queues and topics.
cache
- true
if resolved destinations are to be cachedpublic void setFallbackToDynamicDestination(boolean fallbackToDynamicDestination)
JndiDestinationResolver
to create dynamic destinations
if the destination name is not found in JNDI. Default is false
.
fallbackToDynamicDestination
- true
if this JndiDestinationResolver
instance is to
fallback to resolving destinations dynamicallysetDynamicDestinationResolver(DestinationResolver)
public void setDynamicDestinationResolver(DestinationResolver dynamicDestinationResolver)
DestinationResolver
to use when falling back to dynamic
destinations.
The default is a DynamicDestinationResolver
.
dynamicDestinationResolver
- the DestinationResolver
to use
when falling back to dynamic destinationssetFallbackToDynamicDestination(boolean)
,
DynamicDestinationResolver
public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws JMSException
DestinationResolver
resolveDestinationName
in interface DestinationResolver
session
- the current JMS SessiondestinationName
- the name of the destinationpubSubDomain
- true
if the domain is pub-sub, false
if P2P
JMSException
- if resolution failedprotected void validateDestination(Destination destination, String destinationName, boolean pubSubDomain)
destination
- the Destination object to validatedestinationName
- the name of the destinationpubSubDomain
- true
if a Topic is expected,
false
in case of a Queuepublic void removeFromCache(String destinationName)
CachingDestinationResolver
To be called if access to the specified destination failed, assuming that the JMS Destination object might have become invalid.
removeFromCache
in interface CachingDestinationResolver
destinationName
- the name of the destinationpublic void clearCache()
CachingDestinationResolver
To be called in case of general JMS provider failure.
clearCache
in interface CachingDestinationResolver
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |