/** see execute(operation, client). */ private <T> T execute(Operation<T> operation) throws Exception { return execute(operation, null); }
@Override public String status() { try { return this.execute( new Operation<String>("status") { @Override public String execute(TransactionServiceThriftClient client) throws Exception { return client.status(); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public Transaction startShort(final int timeout) { try { return execute( new Operation<Transaction>("startShort") { @Override public Transaction execute(TransactionServiceThriftClient client) throws TException { return client.startShort(clientId, timeout); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public Transaction startLong() { try { return execute( new Operation<Transaction>("startLong") { @Override public Transaction execute(TransactionServiceThriftClient client) throws TException { return client.startLong(clientId); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public void abort(final Transaction tx) { try { this.execute( new Operation<Boolean>("abort") { @Override public Boolean execute(TransactionServiceThriftClient client) throws TException { client.abort(tx); return true; } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public boolean truncateInvalidTx(final Set<Long> invalidTxIds) { try { return this.execute( new Operation<Boolean>("truncateInvalidTx") { @Override public Boolean execute(TransactionServiceThriftClient client) throws TException { return client.truncateInvalidTx(invalidTxIds); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public int getInvalidSize() { try { return this.execute( new Operation<Integer>("getInvalidSize") { @Override public Integer execute(TransactionServiceThriftClient client) throws TException { return client.getInvalidSize(); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public void resetState() { try { this.execute( new Operation<Boolean>("resetState") { @Override public Boolean execute(TransactionServiceThriftClient client) throws TException { client.resetState(); return true; } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public void pruneNow() { try { this.execute( new Operation<Void>("pruneNow") { @Override public Void execute(TransactionServiceThriftClient client) throws TException { client.pruneNow(); return null; } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public Transaction checkpoint(final Transaction tx) throws TransactionNotInProgressException { try { return this.execute( new Operation<Transaction>("checkpoint") { @Override Transaction execute(TransactionServiceThriftClient client) throws Exception { return client.checkpoint(tx); } } ); } catch (TransactionNotInProgressException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public Transaction startShort() { try { return execute( new Operation<Transaction>("startShort") { @Override public Transaction execute(TransactionServiceThriftClient client) throws TException { return client.startShort(clientId); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public boolean invalidate(final long tx) { try { return this.execute( new Operation<Boolean>("invalidate") { @Override public Boolean execute(TransactionServiceThriftClient client) throws TException { return client.invalidate(tx); } }); } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public void commitOrThrow(final Transaction tx) throws TransactionFailureException { try { execute( new Operation<Void>("commit") { @Override public Void execute(TransactionServiceThriftClient client) throws Exception { client.commit(tx.getTransactionId(), tx.getWritePointer()); return null; } }); } catch (TransactionNotInProgressException | TransactionConflictException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public boolean truncateInvalidTxBefore(final long time) throws InvalidTruncateTimeException { try { return this.execute( new Operation<Boolean>("truncateInvalidTxBefore") { @Override public Boolean execute(TransactionServiceThriftClient client) throws Exception { return client.truncateInvalidTxBefore(time); } }); } catch (InvalidTruncateTimeException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } }
@Override public InputStream getSnapshotInputStream() throws TransactionCouldNotTakeSnapshotException { try { return this.execute( new Operation<InputStream>("takeSnapshot") { @Override public InputStream execute(TransactionServiceThriftClient client) throws Exception { return client.getSnapshotStream(); } }); } catch (TransactionCouldNotTakeSnapshotException e) { throw e; } catch (Exception e) { throw Throwables.propagate(e); } }
execute( new Operation<Void>("canCommit") { @Override