A wrapper for an instance of
ValueResolver
in which
the delegate is only invoked once and the obtained value is cached.
This is useful in cases in which its expensive for the
delegate
to resolve the value.
Care should be taken when using this class to wrap resolvers which
isDynamic()
method return
true
. Since this wrapper
will cache the result of the first invocation, the resolver's dynamism
is in effect neutralized.
This class is thread safe. Many threads can invoke the
resolve(MuleEvent)
method and the underlying
delegate
is still guaranteed to be invoked only once
and the return value to be consistent with that of the thread which first got access to it.
This class can also be used without performance considerations since it's optimized to only
perform thread contention until a value is cached. From then on, no locks will be used while
remaining thread safe