Example usage for com.google.common.util.concurrent Futures get

List of usage examples for com.google.common.util.concurrent Futures get

Introduction

In this page you can find the example usage for com.google.common.util.concurrent Futures get.

Prototype

@Deprecated
@GwtIncompatible("reflection")
public static <V, X extends Exception> V get(Future<V> future, Class<X> exceptionClass) throws X 

Source Link

Document

Returns the result of Future#get() , converting most exceptions to a new instance of the given checked exception type.

Usage

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Rollback a given transaction./*from w w  w  .ja v  a  2  s  . c  om*/
 *
 * You normally rollback a transaction in the event of d Datastore failure.
 *
 * @param txn the transaction.
 * @return the result of the rollback request.
 */
public RollbackResult rollback(final TransactionResult txn) throws DatastoreException {
    return Futures.get(rollbackAsync(Futures.immediateFuture(txn)), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Commit a given transaction.//from w  ww .j a  v a2s .co  m
 *
 * You normally manually commit a transaction after performing read-only
 * operations without mutations.
 *
 * @param txn the transaction.
 * @return the result of the commit request.
 */
public MutationResult commit(final TransactionResult txn) throws DatastoreException {
    return Futures.get(executeAsync((MutationStatement) null, Futures.immediateFuture(txn)),
            DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a allocate ids statement./* w  w w  .  ja va2  s. c  o  m*/
 *
 * @param statement the statement to execute.
 * @return the result of the allocate ids request.
 */
public AllocateIdsResult execute(final AllocateIds statement) throws DatastoreException {
    return Futures.get(executeAsync(statement), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a keyed query statement.//w ww  . ja  v a 2 s .  c  om
 *
 * @param statement the statement to execute.
 * @return the result of the query request.
 */
public QueryResult execute(final KeyQuery statement) throws DatastoreException {
    return Futures.get(executeAsync(statement), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a multi-keyed query statement.
 *
 * @param statements the statements to execute.
 * @return the result of the query request.
 *///from  w  ww .  j  a  v a 2s  .  com
public QueryResult execute(final List<KeyQuery> statements) throws DatastoreException {
    return Futures.get(executeAsync(statements), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a keyed query statement in a given transaction.
 *
 * @param statement the statement to execute.
 * @param txn the transaction to execute the query.
 * @return the result of the query request.
 *//* w  w w .j  av  a 2 s  . c o m*/
public QueryResult execute(final KeyQuery statement, final TransactionResult txn) throws DatastoreException {
    return Futures.get(executeAsync(statement, Futures.immediateFuture(txn)), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a multi-keyed query statement in a given transaction.
 *
 * @param statements the statements to execute.
 * @param txn the transaction to execute the query.
 * @return the result of the query request.
 *//*  w ww.j  a  v  a  2 s  . c  om*/
public QueryResult execute(final List<KeyQuery> statements, final TransactionResult txn)
        throws DatastoreException {
    return Futures.get(executeAsync(statements, Futures.immediateFuture(txn)), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a mutation query statement.// w ww.j  ava  2 s  . co  m
 *
 * @param statement the statement to execute.
 * @return the result of the mutation request.
 */
public MutationResult execute(final MutationStatement statement) throws DatastoreException {
    return Futures.get(executeAsync(statement), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a mutation query statement in a given transaction.
 *
 * @param statement the statement to execute.
 * @param txn the transaction to execute the query.
 * @return the result of the mutation request.
 *//*from   w  ww  . j  av a2  s  . c  o  m*/
public MutationResult execute(final MutationStatement statement, final TransactionResult txn)
        throws DatastoreException {
    return Futures.get(executeAsync(statement, Futures.immediateFuture(txn)), DatastoreException.class);
}

From source file:com.spotify.asyncdatastoreclient.Datastore.java

/**
 * Execute a query statement.//from w  ww  . j av  a2s  .  c om
 *
 * @param statement the statement to execute.
 * @return the result of the query request.
 */
public QueryResult execute(final Query statement) throws DatastoreException {
    return Futures.get(executeAsync(statement), DatastoreException.class);
}