<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>Pete Muir opened an issue a few weeks ago (<a href="https://issues.jboss.org/browse/JBIDE-12224">https://issues.jboss.org/browse/JBIDE-12224</a>) because he found that the JAX-RS tooling was sometimes taking too much time to build. He also attached a video to show what's happening on his machine:&nbsp;<a href="http://screencast.com/t/pHBqxVas4">http://screencast.com/t/pHBqxVas4</a></div><div><br></div><div>Now, at the tooling level, here's what's happening: a set of jars are added to the classpath, and as part of the project build, the JAX-RS builder searches for some JAX-RS annotated types or methods in those new jars, using the Search API. Hélas, Eclipse needs to index those jars, which sometimes takes a few seconds.</div><div>Now, as opposed to the CDI specification where the jars should have a marker file (META-INF/beans.xml), JAX-RS does not mandate anything similar, which means that the search includes all the jars..</div><div><br></div><div>Here's an example of the code that deals with annotated types search (in ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/jdt/JaxrsAnnotationsScanner.java) :</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space: pre; ">        </span><span style="color: #931066">private</span> <span style="color: #931066">static</span> List&lt;IType&gt; searchForAnnotatedTypes(<span style="color: #931066">final</span> Class&lt;?&gt; annotation, <span style="color: #931066">final</span> IJavaSearchScope searchScope,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span><span style="color: #931066">final</span> IProgressMonitor progressMonitor) <span style="color: #931066">throws</span> CoreException {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>JavaMemberSearchResultCollector collector = <span style="color: #931066">new</span> JavaMemberSearchResultCollector(IJavaElement.<span style="color: #2120c8">TYPE</span>, searchScope);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>SearchPattern pattern = SearchPattern.createPattern(annotation.getName(), IJavaSearchConstants.<span style="color: #2120c8">ANNOTATION_TYPE</span>,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>IJavaSearchConstants.<span style="color: #2120c8">ANNOTATION_TYPE_REFERENCE</span> | IJavaSearchConstants.<span style="color: #2120c8">TYPE</span>, SearchPattern.<span style="color: #2120c8">R_EXACT_MATCH</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                                </span>| SearchPattern.<span style="color: #2120c8">R_CASE_SENSITIVE</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(78, 144, 116); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>// perform search, results are added/filtered by the custom</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(78, 144, 116); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>// searchRequestor defined above</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #931066">new</span> SearchEngine().search(pattern, <span style="color: #931066">new</span> SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() },</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>searchScope, collector, progressMonitor);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #931066">return</span> collector.getResult(IType.<span style="color: #931066">class</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>}</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="3"><br></font></div><div>Do you know any way to reduce the latency at this level ? Is there any trick to improve the speed ?</div><div>&nbsp;</div><div>Thanks in advance</div><div>Best regards,</div><div><div apple-content-edited="true">
/Xavier<br><br><br>
</div>
<br></div></body></html>