mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02: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:
parent
603e0470cc
commit
cd314bdc75
36 changed files with 443 additions and 680 deletions
|
@ -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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue