HBASE-27369 BufferedMutator#mutate supports mutation type verification
This commit is contained in:
parent
3f38dcd3f9
commit
8a960d3ccd
|
@ -56,6 +56,9 @@ public interface AsyncBufferedMutator extends Closeable {
|
|||
* @param mutation The data to send.
|
||||
*/
|
||||
default CompletableFuture<Void> mutate(Mutation mutation) {
|
||||
if (!(mutation instanceof Put) && !(mutation instanceof Delete)) {
|
||||
throw new UnsupportedOperationException("Only supports Put and Delete mutation");
|
||||
}
|
||||
return Iterables.getOnlyElement(mutate(Collections.singletonList(mutation)));
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class BufferedMutatorOverAsyncBufferedMutator implements BufferedMutator {
|
|||
@Override
|
||||
public void mutate(Mutation mutation) throws IOException {
|
||||
if (!(mutation instanceof Put) && !(mutation instanceof Delete)) {
|
||||
throw new IOException("Only supports Put and Delete mutation");
|
||||
throw new UnsupportedOperationException("Only supports Put and Delete mutation");
|
||||
}
|
||||
mutate(Collections.singletonList(mutation));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue