Skip to content

Performance improvement on AbstractCachingViewResolver [SPR-3145] #7831

Closed
@spring-projects-issues

Description

@spring-projects-issues

Reza Aliakbari opened SPR-3145 and commented

I got Spring 2.0.1 and I found a performance issue on this class that can slightly improve the performance of this object especially when there is a high load on this object.
On the method resolveViewName the code could be changed as follow

View view = (View) this.viewCache.get(cacheKey);
if (view == null) {
     synchronized (this.viewCache) {
          View view = (View) this.viewCache.get(cacheKey);
          if (view == null) {
           ......
          }
         .....
    }
}

I also see the following comment // No synchronization, as we can live with occasional double caching. That is correct, but with the upper solution we don't need to be worry of extra object problem and also we have good performance.

Cheers,
Reza


Affects: 2.0.1

Issue Links:

Referenced from: commits 06c6cbb

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions