@Override protected long checkAndPutResourceImpl(String resPath, byte[] content, long oldTS, long newTS) throws IOException, IllegalStateException { HTableInterface table = getConnection().getTable(getAllInOneTableName()); try { byte[] row = Bytes.toBytes(resPath); byte[] bOldTS = oldTS == 0 ? null : Bytes.toBytes(oldTS); Put put = buildPut(resPath, newTS, row, content, table); boolean ok = table.checkAndPut(row, B_FAMILY, B_COLUMN_TS, bOldTS, put); if (!ok) throw new IllegalStateException("Overwriting conflict " + resPath + ", expect old TS " + oldTS + ", but it is " + getResourceTimestamp(resPath)); table.flushCommits(); return newTS; } finally { IOUtils.closeQuietly(table); } }
@Override public Boolean runWith(HTableInterface hTable) throws IOException { return hTable.checkAndPut(row, cf, qual, value, put); } });
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { return table.checkAndPut(row, family, qualifier, value, put); }
@Override public Boolean run(HTableInterface table) throws IOException, InterruptedException { return table.checkAndPut(row, family, qualifier, value, put); } });
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(row, family, qualifier, value, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public boolean checkAndPut(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp, byte[] bytes3, Put put) throws IOException { if (allowNonTransactional) { return hTable.checkAndPut(bytes, bytes1, bytes2, compareOp, bytes3, put); } else { throw new UnsupportedOperationException("Operation is not supported transactionally"); } }
@Override public void publishEvent(byte[] row, byte[] payload) throws IOException { Put messagePut = new Put(row); messagePut.add(RecordCf.DATA.bytes, RecordColumn.PAYLOAD.bytes, 1L, payload); boolean rowIsPut = getPayloadTable() .checkAndPut(row, RecordCf.DATA.bytes, RecordColumn.DELETED.bytes, FALSE_BYTES, messagePut); if (! rowIsPut) LogFactory.getLog(getClass()).warn("Did not publish event as requested, row=" + Arrays.toString(row)); }
@Override public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException { HTableInterface htable = getTable(table.array()); try { return htable.checkAndPut(row.array(), family.array(), qualifier.array(), (value == null) ? null : value.array(), putFromThrift(put)); } catch (IOException e) { throw getTIOError(e); } finally { closeTable(htable); } }