Top Description Fields Constructors Methods
org.springframework.messaging.core

public Class CachingDestinationResolverProxy<D>

extends Object
implements DestinationResolver<D>, InitializingBean
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.InitializingBean, org.springframework.messaging.core.DestinationResolver
Type Parameters
<D>
the destination type
Imports
java.util.Map, java.util.concurrent.ConcurrentHashMap, org.springframework.beans.factory.InitializingBean, org.springframework.lang.Nullable, org.springframework.util.Assert

DestinationResolver implementation that proxies a target DestinationResolver, caching its resolveDestination results. Such caching is particularly useful if the destination resolving process is expensive (e.g. the destination has to be resolved through an external system) and the resolution results are stable anyway.
Authors
Agim Emruli, Juergen Hoeller
Since
4.1
See Also
DestinationResolver#resolveDestination

Field Summary

Modifier and TypeField and Description
private final Map<String, D>
private DestinationResolver<D>

Constructor Summary

AccessConstructor and Description
public
CachingDestinationResolverProxy()

Create a new CachingDestinationResolverProxy, setting the target DestinationResolver through the setTargetDestinationResolver bean property.

public
CachingDestinationResolverProxy(DestinationResolver<D>
the target DestinationResolver to delegate to
targetDestinationResolver
)

Create a new CachingDestinationResolverProxy using the given target DestinationResolver to actually resolve destinations.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

public D

Returns:

the currently resolved destination or an already cached destination
resolveDestination
(String
the destination name to be resolved
name
)

Implements org.springframework.messaging.core.DestinationResolver.resolveDestination.

Resolves and caches destinations if successfully resolved by the target DestinationResolver implementation.
public void
setTargetDestinationResolver(DestinationResolver<D> targetDestinationResolver)

Set the target DestinationResolver to delegate to.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resolvedDestinationCacheback to summary
private final Map<String, D> resolvedDestinationCache
targetDestinationResolverback to summary
private DestinationResolver<D> targetDestinationResolver
Annotations
@Nullable

Constructor Detail

CachingDestinationResolverProxyback to summary
public CachingDestinationResolverProxy()

Create a new CachingDestinationResolverProxy, setting the target DestinationResolver through the setTargetDestinationResolver bean property.

CachingDestinationResolverProxyback to summary
public CachingDestinationResolverProxy(DestinationResolver<D> targetDestinationResolver)

Create a new CachingDestinationResolverProxy using the given target DestinationResolver to actually resolve destinations.

Parameters
targetDestinationResolver:DestinationResolver<D>

the target DestinationResolver to delegate to

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

Annotations
@Override
resolveDestinationback to summary
public D resolveDestination(String name) throws DestinationResolutionException

Implements org.springframework.messaging.core.DestinationResolver.resolveDestination.

Resolves and caches destinations if successfully resolved by the target DestinationResolver implementation.

Parameters
name:String

the destination name to be resolved

Returns:D

the currently resolved destination or an already cached destination

Annotations
@Override
Exceptions
DestinationResolutionException:
if the target DestinationResolver reports an error during destination resolution
setTargetDestinationResolverback to summary
public void setTargetDestinationResolver(DestinationResolver<D> targetDestinationResolver)

Set the target DestinationResolver to delegate to.