@Override public boolean swap(byte[] row, byte[] column, byte[] oldValue, byte[] newValue) { return v3HBaseTable.swap(row, column, oldValue, newValue); }
@Override public Boolean call() { return delegate.swap(row, column, oldValue, newValue); } });
public void run() { for (long i = 0; i < rounds; i++) { try { boolean success = table.swap(row, col, Bytes.toBytes(i), Bytes.toBytes(i + 1)); counts[success ? 0 : 1].incrementAndGet(); } catch (Exception e) { System.err.println("exception for swap #" + rounds + ": " + e.getMessage()); e.printStackTrace(); } } } }
if (v3MetricsTable.swap(rowKey, entry.getKey(), null, entry.getValue())) { gaugeDeletes.add(entry.getKey()); } else {
Assert.assertTrue(table.swap(A, P, A, B)); Assert.assertEquals(Bytes.toLong(B), Bytes.toLong(table.get(A, P))); Assert.assertFalse(table.swap(A, P, A, B)); Assert.assertArrayEquals(B, table.get(A, P)); Assert.assertFalse(table.swap(B, Q, A, B)); Assert.assertNull(table.get(B, Q)); Assert.assertTrue(table.swap(A, P, B, null)); Assert.assertNull(table.get(A, P)); Assert.assertFalse(table.swap(A, Q, A, null)); Assert.assertArrayEquals(Y, table.get(A, Q)); Assert.assertTrue(table.swap(A, P, null, Z)); Assert.assertArrayEquals(Z, table.get(A, P)); Assert.assertFalse(table.swap(A, Q, null, Z)); Assert.assertArrayEquals(Y, table.get(A, Q));