* expensive UriTemplateMatcher.matches()
*/
previousMatched = uriToResourceCache.get(isContinuedSearchPolicy).get(uri);
if (previousMatched != null) {
for (ResourceRecord record : previousMatched) {
UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
if (matcher.matches(uri)) {
found.add(new ResourceInstance(record, matcher));
}
}
return found;
}
readersLock.lock();
try {
previousMatched = new ArrayList<ResourceRecord>();
// the list of root resource records is already sorted
for (ResourceRecord record : rootResources) {
UriTemplateMatcher matcher = record.getTemplateProcessor().matcher();
if (matcher.matches(uri)) {
if (matcher.isExactMatch() || record.hasSubResources()) {
previousMatched.add(record);
found.add(new ResourceInstance(record, matcher));
if (!isContinuedSearchPolicy) {
break;
}