/** * Method to execute a Put mutation operation on Hypertable. * * @param tableName * @param put * @throws ClientException * @throws TException * @see Put */ public void put(String tableName, Put put) throws ClientException, TException { long mutator = client.mutator_open(ns, tableName, 0, 0); try { if (put._getCells().size() > 1) client.mutator_set_cells(mutator, put._getCells()); else if (put._getCells().size() == 1) client.mutator_set_cell(mutator, put._getCells().get(0)); } finally { client.mutator_close(mutator); } }
/** * Method to execute a batch Put mutation operation on Hypertable. * * @param tableName * @param puts * @throws ClientException * @throws TException */ public void put(String tableName, List<Put> puts) throws ClientException, TException { long mutator = client.mutator_open(ns, tableName, 0, 0); List<Cell> cells = new LinkedList<Cell>(); for (Put put : puts) cells.addAll(put._getCells()); try { if (cells.size() > 1) client.mutator_set_cells(mutator, cells); else if (cells.size() == 1) client.mutator_set_cell(mutator, cells.get(0)); } finally { client.mutator_close(mutator); } }