~pbeaman/akiban-persistit/3.3.1-SNAPSHOT

« back to all changes in this revision

Viewing changes to src/test/java/com/persistit/stress/unit/Stress8txn.java

merge pbeaman: Improve the Javadoc for com.persistit.Accumulator to provide better information about snapshot and live values, and the semantics of the update method.

https://code.launchpad.net/~pbeaman/akiban-persistit/fix-accumulator-javadoc/+merge/158163

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
package com.persistit.stress.unit;
17
17
 
18
 
import com.persistit.Accumulator;
 
18
import com.persistit.Accumulator.SumAccumulator;
19
19
import com.persistit.Exchange;
20
20
import com.persistit.Key;
21
21
import com.persistit.Transaction;
199
199
 
200
200
            }
201
201
 
202
 
            final Accumulator acc1 = _exs.getTree().getAccumulator(Accumulator.Type.SUM, _c1);
203
 
            final Accumulator acc2 = _exs.getTree().getAccumulator(Accumulator.Type.SUM, _c2);
204
 
            acc1.update(delta, _exs.getTransaction());
205
 
            acc2.update(-delta, _exs.getTransaction());
 
202
            final SumAccumulator acc1 = _exs.getTree().getSumAccumulator(_c1);
 
203
            final SumAccumulator acc2 = _exs.getTree().getSumAccumulator(_c2);
 
204
            acc1.add(delta);
 
205
            acc2.add(-delta);
206
206
        }
207
207
    }
208
208
 
252
252
                addWork(1);
253
253
 
254
254
            }
255
 
            final Accumulator acc1 = _exs.getTree().getAccumulator(Accumulator.Type.SUM, _c1);
256
 
            final Accumulator acc2 = _exs.getTree().getAccumulator(Accumulator.Type.SUM, _c2);
257
 
            acc1.update(delta, _exs.getTransaction());
258
 
            acc2.update(-delta, _exs.getTransaction());
 
255
            final SumAccumulator acc1 = _exs.getTree().getSumAccumulator(_c1);
 
256
            final SumAccumulator acc2 = _exs.getTree().getSumAccumulator(_c2);
 
257
            acc1.add(delta);
 
258
            acc2.add(-delta);
259
259
        }
260
260
    }
261
261
 
410
410
        }
411
411
        int totalAcc = 0;
412
412
        for (int i = 0; i < 25; i++) {
413
 
            final Accumulator acc = _exs.getTree().getAccumulator(Accumulator.Type.SUM, i);
414
 
            totalAcc += acc.getSnapshotValue(_exs.getTransaction());
 
413
            final SumAccumulator acc = _exs.getTree().getSumAccumulator(i);
 
414
            totalAcc += acc.getSnapshotValue();
415
415
        }
416
416
        if (totalAcc != 0) {
417
417
            fail("totalAcc=" + totalAcc);