<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 11:51 AM, Pedro Ruivo <span dir="ltr"><<a href="mailto:pedro@infinispan.org" target="_blank">pedro@infinispan.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im"><br>
<br>
On 05/14/2013 09:44 AM, Dan Berindei wrote:<br>
><br>
><br>
><br>
> On Tue, May 14, 2013 at 11:37 AM, Manik Surtani <<a href="mailto:msurtani@redhat.com">msurtani@redhat.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:msurtani@redhat.com">msurtani@redhat.com</a>>> wrote:<br>
><br>
><br>
> On 14 May 2013, at 08:33, Dan Berindei <<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>>> wrote:<br>
><br>
>> If we want to keep it hidden, then I think it would be best to<br>
>> leave the getTimeService() method only in<br>
>> ComponentRegistry/GlobalComponentRegistry and remove it from the<br>
>> AdvancedCache interface.<br>
><br>
> +1.<br>
<br>
</div>first I have two situations here:<br>
<br>
in production: it's indifferent for me have it in the AdvancedCache or<br>
in the ComponentRegistry, in the cache loader/store and in the Extended<br>
Stats I have access to the cache and I can pick from everywhere.<br>
<br>
in the test suite: I first try to have it only in the ComponentRegistry<br>
and I was not be able to mock it because the class is final (I believe<br>
that is final for some reason). In addition, all the cache store tests<br>
mocks the Cache interface. That's why I put it in the AdvancedCache.<br>
<div class="im"><br></div></blockquote><div><br></div><div>Yeah, being able to inject the TimeService directly in the cache store would have been nice :)<br></div><div>I think we can remove the final modifier from the ComponentRegistry class, though.<br>
</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
><br>
>> We might want to remove it from the configuration, too.<br>
><br>
> It is definitely *not* configurable and *not* a part of the<br>
> configuration. See an earlier thread on this subject:<br>
> <a href="http://bit.ly/102aQ9R" target="_blank">http://bit.ly/102aQ9R</a><br>
<br>
</div>This is another issue I have. I need to have the TimeService in the<br>
Extended Stats and this are a CustomInterceptor. My first try was to<br>
replace and rewire the GlobalComponent but this does not work because I<br>
don't have any @Inject method in the CustomInterceptor where I can<br>
replace for TimeService implementation in the test suite. That's why it<br>
is in the GlobalConfiguration.<br>
<br></blockquote><div><br></div><div>cache.getAdvancedCache().getComponentRegistry().getTimeService() should work in a custom interceptor.<br></div><div>You just have to mock the cache and the component registry...<br><br>
</div></div></div></div>