gerrit/gerrit-sshd
David Ostrovsky 2605168713 User memoized supplier pattern to reduce resource consumption
It's pointless to retrieve the whole data from the database and git
backends when it's thrown away anyway. Use memoized supplier pattern
to only retrieve the data if really needed. We need memoization in
this context to ensure, that when the data is retrieved, it is done
only once and not multiple times in different plugins and in hooks
firing tool chain.

This change breaks plugins that consume change events. However, given
that only few plugins, e.g. reviewers, are affected by this change,
this API change is justfied, as it's substantially decreasing the
load on the gerrit site.

One side effect of this change is stream event JSON serialization. Use
custom JSON serializer to resolve supplier with their content.

Test Plan:

Non retrieval of data wth default gerrit install + reviewers plugin.

1. install gerrit with all core plugins
2. install reviewers plugin
3. create a group_100 that contains 100 users
4. add a reviewer to a change and select the group_100

Without this change hundreds of SQL select statements are executed in
vain. That's because 100 ChangeEvents instances are created and multiple
SQL select statements are executed per instance. With this change exact
0 select SQL statements are executed. Memoized suppliers are created
but not used.

Change-Id: I10e257be37ff60276e4187659926fe32e5be136b
Reported-By: Luca Milanesio <luca.milanesio@gmail.com>
2015-12-31 17:50:26 +00:00
..
src User memoized supplier pattern to reduce resource consumption 2015-12-31 17:50:26 +00:00
BUCK Merge branch 'stable-2.12' 2015-11-12 12:48:06 -08:00