jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chetan Mehrotra <chetan.mehro...@gmail.com>
Subject Re: svn commit: r1547017 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoNodeStore.java test/java/org/apache/jackrabbit/oak/plugins/mongomk/BackgroundWriteTest.java
Date Tue, 03 Dec 2013 05:04:07 GMT
Hi Marcel,

Probably below code can be simplified using the Lists.partition(list,size) [1]

> -            // update if this is the last path or
> -            // revision is not equal to last revision
> -            if (i + 1 >= paths.size() || size == ids.size()) {
> +            // call update if any of the following is true:
> +            // - this is the last path
> +            // - revision is not equal to last revision (size of ids didn't change)
> +            // - the update limit is reached
> +            if (i + 1 >= paths.size()
> +                    || size == ids.size()
> +                    || ids.size() >= BACKGROUND_MULTI_UPDATE_LIMIT) {
>                  store.update(Collection.NODES, ids, updateOp);
>                  for (String id : ids) {
>                      unsavedLastRevisions.remove(Utils.getPathFromId(id));
>


Chetan Mehrotra
[1] http://docs.guava-libraries.googlecode.com/git-history/release/javadoc/com/google/common/collect/Lists.html#partition(java.util.List,
int)

Mime
View raw message