<div dir="ltr"><div><div>So while I was trying to work on this, I have to admit I am even more torn in regards to what to do.  Looking at [1]  it looks like the template should only be applied if the cache configuration is not currently defined.  Unfortunately it doesn&#39;t work this way and always applies this template to any existing configuration. So I am thinking an alternative is to instead make it work as the documentation states, only using the template if the cache is not currently defined.  This seems more logical to me at least.<br><br></div>With that change the getCache(String, String) could stay as long as it is documented that a template is only applied if no cache configuration exists.<br><br></div>What do you guys think?<br><div><div><br>[1] <a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java#L84">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java#L84</a><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 27, 2017 at 10:09 AM William Burns &lt;<a href="mailto:mudokonman@gmail.com">mudokonman@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Mon, Feb 27, 2017 at 9:55 AM Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com" class="gmail_msg" target="_blank">dan.berindei@gmail.com</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would go for option 2.<br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">Do you think a WARN message will be enough? I am a bit weary about this option myself.</div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
We already started disconnecting the cache definition and retrieval,<br class="gmail_msg">
at least `getCache(name)` doesn&#39;t define a new cache based on the<br class="gmail_msg">
default configuration any more. So I don&#39;t think it would be too much,<br class="gmail_msg">
even at this point, to deprecate all the overloads of `getCache` that<br class="gmail_msg">
can define a new cache and advise users to use `defineConfiguration`<br class="gmail_msg">
instead.<br class="gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">Hrmm I like the idea of deprecating the overloads :)</div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Cheers<br class="gmail_msg">
Dan<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
On Mon, Feb 27, 2017 at 4:31 PM, William Burns &lt;<a href="mailto:mudokonman@gmail.com" class="gmail_msg" target="_blank">mudokonman@gmail.com</a>&gt; wrote:<br class="gmail_msg">
&gt; When working on another project using Infinispan the code being used was a<br class="gmail_msg">
&gt; bit interesting and I don&#39;t think our template configuration handling was<br class="gmail_msg">
&gt; expecting it do so in such a way.<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Essentially the code defined a template for a distributed cache as well as<br class="gmail_msg">
&gt; some named caches.  Then whenever a cache is retrieved it would pass the<br class="gmail_msg">
&gt; given name and always the distributed cache template.  Unfortunately with<br class="gmail_msg">
&gt; the way templates work they essentially redefine a cache first so the actual<br class="gmail_msg">
&gt; cache configuration was wiped out.  In this example I was able to get the<br class="gmail_msg">
&gt; code to change to using a default cache instead, which is the behavior that<br class="gmail_msg">
&gt; is needed.<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; The issue though at hand is whether we should allow a user to call getCache<br class="gmail_msg">
&gt; in such a way. My initial thought is to have it throw some sort of<br class="gmail_msg">
&gt; configuration exception when this is invoked. But there are some possible<br class="gmail_msg">
&gt; options.<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; 1. Throw a configuration exception not allowing a user to use a template<br class="gmail_msg">
&gt; with an already defined cache. This has a slight disconnect between<br class="gmail_msg">
&gt; configuration and runtime, since if a user adds a new definition it could<br class="gmail_msg">
&gt; cause runtime issues.<br class="gmail_msg">
&gt; 2. Log an error/warning message when this occurs. Is this enough though?<br class="gmail_msg">
&gt; Still could have runtime issues that are possibly undetected.<br class="gmail_msg">
&gt; 3. Merge the configurations together applying the template first.  This<br class="gmail_msg">
&gt; would be akin to how default cache works currently, but you would get to<br class="gmail_msg">
&gt; define your default template configuration at runtime. This sounded like the<br class="gmail_msg">
&gt; best option to me, but the problem is what if someone calls getCache using<br class="gmail_msg">
&gt; the same cache name but a different template. This could get hairy as well.<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Really thinking about the future, disconnecting the cache definition and<br class="gmail_msg">
&gt; retrieval would be the best option, but we can&#39;t do that this late in the<br class="gmail_msg">
&gt; game.<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; What do you guys think?<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;  - Will<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; _______________________________________________<br class="gmail_msg">
&gt; infinispan-dev mailing list<br class="gmail_msg">
&gt; <a href="mailto:infinispan-dev@lists.jboss.org" class="gmail_msg" target="_blank">infinispan-dev@lists.jboss.org</a><br class="gmail_msg">
&gt; <a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
infinispan-dev mailing list<br class="gmail_msg">
<a href="mailto:infinispan-dev@lists.jboss.org" class="gmail_msg" target="_blank">infinispan-dev@lists.jboss.org</a><br class="gmail_msg">
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br class="gmail_msg">
</blockquote></div></div></blockquote></div></div></div></div></div>