client.put(action).addCallbacks(putSuccessCallback, putFailureCallback);
/** * Store the specified cell(s). * * @param request the cell(s) to store. * * @return a {@link Deferred} indicating the completion of the store operation. * * @see org.hbase.async.HBaseClient#put(org.hbase.async.PutRequest) */ public Deferred<Object> put(final PutRequest request) { return client.put(request); }
/** * Puts the given value into the data table. */ final Deferred<Object> put(final byte[] key, final byte[] qualifier, final byte[] value) { return client.put(new PutRequest(table, key, FAMILY, qualifier, value)); }
while (attempts-- > 0) { try { client.put(put).joinUninterruptibly(); return; } catch (HBaseException e) {
@Override protected void onQuanta(byte[] keyBytes, byte[] valueBytes) { switch (getTaskOperation()) { case WRITE: PutRequest request = new PutRequest(table, keyBytes, columnFamily, qualifier, valueBytes); Deferred<Object> d = client.put(request); try { logger.info("Put result: " + d.joinUninterruptibly()); } catch (Exception e) { logger.warn("Error while waiting for deferred", e); } break; case READ: // TODO break; } }
private void _put(String tableName, String rowKey) { _logger.debug(MessageFormat.format("Inserting rowkey {0} into table {1}", rowKey, tableName)); final PutRequest put = new PutRequest(Bytes.toBytes(tableName), Bytes.toBytes(rowKey), COLUMN_FAMILY, COLUMN_QUALIFIER, CELL_VALUE); Deferred<Object> deferred = _client.put(put); deferred.addCallback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { _logger.trace(MessageFormat.format("Put to {0} successfully.", tableName)); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception e) throws Exception { throw new SystemException("Error occurred while trying to execute put().", e); } }); if(_syncPut) { try { deferred.join(TIMEOUT_MS); } catch (InterruptedException e) { _logger.warn("Interrupted while waiting for put to finish.", e); } catch (Exception e) { _logger.error("Exception while trying to put schema records.", e); throw new SystemException(e); } } }
private void _put(String tableName, String rowKey) { _logger.debug(MessageFormat.format("Inserting rowkey {0} into table {1}", rowKey, tableName)); final PutRequest put = new PutRequest(Bytes.toBytes(tableName), Bytes.toBytes(rowKey), COLUMN_FAMILY, COLUMN_QUALIFIER, CELL_VALUE); Deferred<Object> deferred = _client.put(put); deferred.addCallback(new Callback<Object, Object>() { @Override public Object call(Object arg) throws Exception { _logger.trace(MessageFormat.format("Put to {0} successfully.", tableName)); return null; } }); deferred.addErrback(new Callback<Object, Exception>() { @Override public Object call(Exception e) throws Exception { throw new SystemException("Error occurred while trying to execute put().", e); } }); if(_syncPut) { try { deferred.join(TIMEOUT_MS); } catch (InterruptedException e) { _logger.warn("Interrupted while waiting for put to finish.", e); } catch (Exception e) { _logger.error("Exception while trying to put schema records.", e); throw new SystemException(e); } } }
COLUMN_QUALIFIER, value); Deferred<Object> deferred = _client.put(put);
COLUMN_QUALIFIER, value); Deferred<Object> deferred = _client.put(put);
COLUMN_QUALIFIER, value); Deferred<Object> deferred = _client.put(put);
COLUMN_QUALIFIER, value); Deferred<Object> deferred = _client.put(put);
private Deferred<Object> addPointInternal(final String metric, final long timestamp, final byte[] value, final Map<String, String> tags, final short flags) { if ((timestamp & 0xFFFFFFFF00000000L) != 0) { // => timestamp < 0 || timestamp > Integer.MAX_VALUE throw new IllegalArgumentException((timestamp < 0 ? "negative " : "bad") + " timestamp=" + timestamp + " when trying to save value=" + Arrays.toString(value) + '/' + flags + " to metric=" + metric + ", tags=" + tags); } IncomingDataPoints.checkMetricAndTags(metric, tags); final byte[] row = IncomingDataPoints.rowKeyTemplate(this, metric, tags); final long base_time = (timestamp - (timestamp % Const.MAX_TIMESPAN)); Bytes.setInt(row, (int) base_time, metrics.width()); scheduleForCompaction(row, (int) base_time); final short qualifier = (short) ((timestamp - base_time) << Const.FLAG_BITS | flags); final PutRequest point = new PutRequest(table, row, FAMILY, Bytes.fromShort(qualifier), value); // TODO(tsuna): Add a callback to time the latency of HBase and store the // timing in a moving Histogram (once we have a class for this). return client.put(point); }
correctable++; if (fix) { client.put(new PutRequest(table, ordered.key(), ordered.family(), ordered.qualifier(), client.put(new PutRequest(table, kv.key(), kv.family(), qual, value)); } else { final DeleteOutOfOrder delooo = new DeleteOutOfOrder(kv); if (timestamp < prev.timestamp()) { client.put(new PutRequest(table, newkey, kv.family(), Bytes.fromShort(newqual), value))
return tsdb.client.put(point)/*.addBoth(cb)*/;
client.put(action).addCallbacks(putSuccessCallback, putFailureCallback);