]> source.dussan.org Git - vaadin-framework.git/commit
Improves performance of VaadinService.requestEnd(). (#14218)
authorFabian Lange <lange.fabian@gmail.com>
Fri, 11 Jul 2014 22:00:41 +0000 (00:00 +0200)
committerFabian Lange <lange.fabian@gmail.com>
Mon, 21 Jul 2014 11:55:59 +0000 (13:55 +0200)
commit4fafa9dbbccc387e0bd3c1a0d44f74b3a111b06c
treea3a0952d5575f1c6939b657d84e494405d72a078
parenta197bd64db7521749c16551cc238890aea0fa113
Improves performance of VaadinService.requestEnd(). (#14218)

Doing two times session.accessSynchronously is unnecessary effort in
multiple aspects:
* The session will be locked twice.
* CurrentInstances are set twice.
* CurrentInstances are restored twice.
* VaadinSession being checked for being the current via
  VaadinService.verifyNoOtherSessionLocked(this);

When we leave requestEnd we unset all CurrentInstances. There is no need
to just restore them before doing so.
When we are in requestEnd, VaadinSession is set to "current" by
PushHandler.callWithUi() or VaadinService.handleRequest().
Also, the cleanupSession code does not need any of these thread locals,
so not having them set would also not hurt.
having an extra accessSynchronously call for just setting the duration
does not make a lot of sense. While it somehow wants to make the previous
accessSynchronously call to be counted completely into the duration it
invests an the same time that would have been left out additionally.

VaadinService removeClosedUIs is a cleanup which also locks and sets
CurrentInstances just to figure out that the UI it is checking is not
closing. This change moves that check out of ui.accessSynchronously.

In the end, the resulting code is a tiny bit less robust, however it
eliminates over 50% response time on trivial push request/responses.

Change-Id: If71d1dbbae5d1fd57d3d4e735c592fd263261a81
server/src/com/vaadin/server/VaadinService.java
server/src/com/vaadin/server/VaadinSession.java