public Transaction startLong() throws TException { try { return TransactionConverterUtils.unwrap(client.startLong()); } catch (TException e) { isValid.set(false); throw e; } }
@Override public TTransaction startShortTimeout(int timeout) throws TException { return TransactionConverterUtils.wrap(txManager.startShort(timeout)); }
public static TTransaction wrap(Transaction tx) { return new TTransaction(tx.getTransactionId(), tx.getReadPointer(), Longs.asList(tx.getInvalids()), Longs.asList(tx.getInProgress()), tx.getFirstShortInProgress(), getTTransactionType(tx.getType()), tx.getWritePointer(), Longs.asList(tx.getCheckpointWritePointers()), getTVisibilityLevel(tx.getVisibilityLevel())); }
public static Transaction unwrap(TTransaction thriftTx) { return new Transaction(thriftTx.getReadPointer(), thriftTx.getTransactionId(), thriftTx.getWritePointer(), thriftTx.getInvalids() == null ? EMPTY_LONG_ARRAY : Longs.toArray(thriftTx.getInvalids()), thriftTx.getInProgress() == null ? EMPTY_LONG_ARRAY : Longs.toArray(thriftTx.getInProgress()), thriftTx.getFirstShort(), getTransactionType(thriftTx.getType()), thriftTx.getCheckpointWritePointers() == null ? EMPTY_LONG_ARRAY : Longs.toArray(thriftTx.getCheckpointWritePointers()), getVisibilityLevel(thriftTx.getVisibilityLevel())); }
@Override public TTransaction checkpoint(TTransaction originalTx) throws TException { try { return TransactionConverterUtils.wrap( txManager.checkpoint(TransactionConverterUtils.unwrap(originalTx))); } catch (TransactionNotInProgressException e) { throw new TTransactionNotInProgressException(e.getMessage()); } }
@Override public TTransaction startShort() throws TException { return TransactionConverterUtils.wrap(txManager.startShort()); }
public Transaction startShort() throws TException { try { return TransactionConverterUtils.unwrap(client.startShort()); } catch (TException e) { isValid.set(false); throw e; } }
public void abort(Transaction tx) throws TException { try { client.abortTx(TransactionConverterUtils.wrap(tx)); } catch (TException e) { isValid.set(false); throw e; } }
@Override public void abortTx(TTransaction tx) throws TException { txManager.abort(TransactionConverterUtils.unwrap(tx)); }
@Override public TTransaction startLong() throws TException { return TransactionConverterUtils.wrap(txManager.startLong()); }
public Transaction startShort(String clientId) throws TException { try { return TransactionConverterUtils.unwrap(client.startShortClientId(clientId)); } catch (TGenericException e) { // currently, we only expect IllegalArgumentException here, if the clientId is null if (!IllegalArgumentException.class.getName().equals(e.getOriginalExceptionClass())) { LOG.trace("Expecting only {} as the original exception class but found {}", IllegalArgumentException.class.getName(), e.getOriginalExceptionClass()); throw e; } throw new IllegalArgumentException(e.getMessage()); } catch (TException e) { isValid.set(false); throw e; } }
@Override public TTransaction startLongClientId(String clientId) throws TException { try { return TransactionConverterUtils.wrap(txManager.startLong(clientId)); } catch (IllegalArgumentException ex) { throw new TGenericException(ex.getMessage(), ex.getClass().getName()); } }
public Transaction startLong(String clientId) throws TException { try { return TransactionConverterUtils.unwrap(client.startLongClientId(clientId)); } catch (TGenericException e) { // currently, we only expect IllegalArgumentException here, if the clientId is null if (!IllegalArgumentException.class.getName().equals(e.getOriginalExceptionClass())) { LOG.trace("Expecting only {} as the original exception class but found {}", IllegalArgumentException.class.getName(), e.getOriginalExceptionClass()); throw e; } throw new IllegalArgumentException(e.getMessage()); } catch (TException e) { isValid.set(false); throw e; } }
@Override public TTransaction startShortClientId(String clientId) throws TException { try { return TransactionConverterUtils.wrap(txManager.startShort(clientId)); } catch (IllegalArgumentException ex) { throw new TGenericException(ex.getMessage(), ex.getClass().getName()); } }
public Transaction startShort(int timeout) throws TException { try { return TransactionConverterUtils.unwrap(client.startShortWithTimeout(timeout)); } catch (TGenericException e) { // currently, we only expect IllegalArgumentException here, if the timeout is invalid if (!IllegalArgumentException.class.getName().equals(e.getOriginalExceptionClass())) { LOG.trace("Expecting only {} as the original exception class but found {}", IllegalArgumentException.class.getName(), e.getOriginalExceptionClass()); throw e; } throw new IllegalArgumentException(e.getMessage()); } catch (TException e) { isValid.set(false); throw e; } }
@Override public TTransaction startShortWithTimeout(int timeout) throws TException { try { return TransactionConverterUtils.wrap(txManager.startShort(timeout)); } catch (IllegalArgumentException e) { throw new TGenericException(e.getMessage(), e.getClass().getName()); } }
public Transaction startShort(String clientId, int timeout) throws TException { try { return TransactionConverterUtils.unwrap(client.startShortWithClientIdAndTimeOut(clientId, timeout)); } catch (TGenericException e) { // currently, we only expect IllegalArgumentException here, if the timeout is invalid or if clientId is null if (!IllegalArgumentException.class.getName().equals(e.getOriginalExceptionClass())) { LOG.trace("Expecting only {} as the original exception class but found {}", IllegalArgumentException.class.getName(), e.getOriginalExceptionClass()); throw e; } throw new IllegalArgumentException(e.getMessage()); } catch (TException e) { isValid.set(false); throw e; } }
@Override public TTransaction startShortWithClientIdAndTimeOut(String clientId, int timeout) throws TException { try { return TransactionConverterUtils.wrap(txManager.startShort(clientId, timeout)); } catch (IllegalArgumentException ex) { throw new TGenericException(ex.getMessage(), ex.getClass().getName()); } }
public Transaction decode(byte[] encoded) throws IOException { TTransaction thriftTx = new TTransaction(); TDeserializer deserializer = new TDeserializer(); try { deserializer.deserialize(thriftTx, encoded); return TransactionConverterUtils.unwrap(thriftTx); } catch (TException te) { throw new IOException(te); } } }