[
https://issues.apache.org/jira/browse/CAMEL-5940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13616204#comment-13616204
]
Piotr Klimczak commented on CAMEL-5940:
---------------------------------------
Hi Clause,
Thanks for your feedback.
Most of the things you are saying are just because of the scheme (like
cache://foo... or myBeanCache://foo...) of the cache is not known when a
component is created (nor doing doStart)- especially the default one (correct
me if I'm wrong). The sheme is used to figure is it a custom scheme (created
for example by a bean in spring) or default one. And this is why some "magic"
is done only when and endpoint is created instead of component.
So according to:
1. you should not alter the state of the cache manager factory when creating an
endpoint. This means the state changes when a new endpoint is created
What I did is a kind of workaround. When component is created, the URI is not
known. It is known only when the endpoint is created, but just because one
component (associated with it's scheme) have one cacheManagerFactory, that is
used for creating endpoints, then each endpoint for this component is setting
same scheme which is always equal to CacheManagerName. This is the only
solution I have found but i would be happy to see better solution for this.
According to:
6. And it would be a good idea to close the configInputStram after your are
done reading it, instead of deffering that to doStop. eg so we close the
resource asap. in the DefaultCacheManagerFactory class.
This is because when i have analyzed the EHcache code I have found that it's
cache configuration engine does not closes the InputStream and even more it is
doing some marking and resetting the stream so the stream is reused many times.
Hope you find it well.
Greetings,
Piotr Klimczak
> camel-cache - Add option to cache component to easily configure ehcache XML
> file to load by default
> ---------------------------------------------------------------------------------------------------
>
> Key: CAMEL-5940
> URL: https://issues.apache.org/jira/browse/CAMEL-5940
> Project: Camel
> Issue Type: Improvement
> Components: camel-cache
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Fix For: 2.11.1
>
> Attachments: 0001-CAMEL-5940-implementation.patch
>
>
> See
> By default ehache.xml is loaded from classpath. We should make it possible to
> configure CacheComponent with a string option that refers to the resource to
> load.
> Then people can do something a like:
> {code}
> <bean id="cache" class="...CacheComponent">
> <property name="configurationFile" value="classpath:com/foo/mycache.xml"/>
> </bean>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira