@PUT
@Path("/{tx_id}/state")
@Transactional
@DeserializeWith(TransactionStateDeserializationStrategy.class)
public void setTransactionState(Invocation req, Output res) throws Exception {
TransactionRegistry txs = req.getTxRegistry();
switch(req.<TransactionStateDeserialization>getContent()) {
case COMMITTED:
txs.commitCurrentTransaction();
break;
case ROLLED_BACK:
txs.rollbackCurrentTransaction();
break;
default:
throw new IllegalArgumentException("Only COMMITTED and ROLLED_BACK transaction states can be set.");
}