1
0
mirror of https://github.com/google/nomulus synced 2026-02-12 15:51:34 +00:00

Replace many Work and VoidWork usages with lambdas

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176153460
This commit is contained in:
mcilwain
2017-11-17 13:38:53 -08:00
committed by jianglai
parent 603e0470cc
commit cd314bdc75
36 changed files with 443 additions and 680 deletions

View File

@@ -20,7 +20,6 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.appengine.tools.mapreduce.Reducer;
import com.google.appengine.tools.mapreduce.ReducerInput;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.VoidWork;
import java.util.Iterator;
import java.util.List;
@@ -37,11 +36,7 @@ public class KillAllEntitiesReducer extends Reducer<Key<?>, Key<?>, Void> {
while (batches.hasNext()) {
final List<Key<?>> batch = batches.next();
// Use a transaction to get retrying for free.
ofy().transact(new VoidWork() {
@Override
public void vrun() {
ofy().deleteWithoutBackup().keys(batch);
}});
ofy().transact(() -> ofy().deleteWithoutBackup().keys(batch));
getContext().incrementCounter("entities deleted", batch.size());
for (Key<?> key : batch) {
getContext().incrementCounter(String.format("%s deleted", key.getKind()));