Search in sources :

Example 6 with TransactionException

use of com.yahoo.elide.core.exceptions.TransactionException in project elide by yahoo.

the class MultiplexWriteTransaction method commit.

@Override
public void commit(RequestScope scope) {
    // flush all before commits
    flush(scope);
    ArrayList<DataStore> commitList = new ArrayList<>();
    for (Entry<DataStore, DataStoreTransaction> entry : transactions.entrySet()) {
        try {
            entry.getValue().commit(scope);
            commitList.add(entry.getKey());
        } catch (HttpStatusException | WebApplicationException e) {
            reverseTransactions(commitList, e, scope);
            throw e;
        } catch (Error | RuntimeException e) {
            TransactionException transactionException = new TransactionException(e);
            reverseTransactions(commitList, transactionException, scope);
            throw transactionException;
        }
    }
}
Also used : TransactionException(com.yahoo.elide.core.exceptions.TransactionException) WebApplicationException(javax.ws.rs.WebApplicationException) DataStore(com.yahoo.elide.core.datastore.DataStore) ArrayList(java.util.ArrayList) DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) HttpStatusException(com.yahoo.elide.core.exceptions.HttpStatusException)

Aggregations

TransactionException (com.yahoo.elide.core.exceptions.TransactionException)6 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)3 IOException (java.io.IOException)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 JacksonException (com.fasterxml.jackson.core.JacksonException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 RequestScope (com.yahoo.elide.core.RequestScope)1 DataStore (com.yahoo.elide.core.datastore.DataStore)1 BadRequestException (com.yahoo.elide.core.exceptions.BadRequestException)1 HttpStatusException (com.yahoo.elide.core.exceptions.HttpStatusException)1 InvalidEntityBodyException (com.yahoo.elide.core.exceptions.InvalidEntityBodyException)1 Type (com.yahoo.elide.core.type.Type)1 GraphQLEntityProjectionMaker (com.yahoo.elide.graphql.parser.GraphQLEntityProjectionMaker)1 GraphQLProjectionInfo (com.yahoo.elide.graphql.parser.GraphQLProjectionInfo)1 PatchRequestScope (com.yahoo.elide.jsonapi.extensions.PatchRequestScope)1 ExecutionInput (graphql.ExecutionInput)1 ExecutionResult (graphql.ExecutionResult)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1