Esempio n. 1
0
 /**
  * Batch executes all mutations scheduled to this Mutator instance by addInsertion, addDeletion
  * etc. May throw a HectorException which is a RuntimeException.
  *
  * @return A MutationResult holds the status.
  */
 @Override
 public MutationResult execute() {
   if (pendingMutations == null || pendingMutations.isEmpty()) {
     return new MutationResultImpl(true, 0, null);
   }
   final BatchMutation<K> mutations = pendingMutations.makeCopy();
   pendingMutations = null;
   return new MutationResultImpl(
       keyspace.doExecute(
           new KeyspaceOperationCallback<Void>() {
             @Override
             public Void doInKeyspace(KeyspaceService ks) throws HectorException {
               ks.batchMutate(mutations);
               return null;
             }
           }));
 }