/** * 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.doExecuteOperation(new Operation<Void>(OperationType.WRITE) { @Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } })); }
/** * 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.doExecuteOperation(new Operation<Void>(OperationType.WRITE) { @Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } })); }
/** * 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.doExecuteOperation(new Operation<Void>(OperationType.WRITE) { @Override public Void execute(Cassandra.Client cassandra) throws Exception { cassandra.batch_mutate(mutations.getMutationMap(), ThriftConverter.consistencyLevel(consistencyLevelPolicy.get(operationType))); return null; } })); }