public void setTransactionLevel(String txLevel) throws BagriException { logger.debug("setTransactionLevel.enter; got tx level: {}", txLevel); if (txLevel == null || txLevel.isEmpty() || txLevel.equals(pv_client_txLevel_skip)) { this.txLevel = null; } else { this.txLevel = TransactionIsolation.valueOf(txLevel); } logger.debug("setTransactionLevel.exit; default tx level set to: {}", this.txLevel); }
public TransactionIsolation getTransactionLevel(Properties context) { String txLevel = context.getProperty(pn_client_txLevel); if (txLevel == null) { return ((TransactionManagementImpl) getTxManagement()).getTransactionLevel(); } else { if (pv_client_txLevel_skip.equals(txLevel)) { return null; } return TransactionIsolation.valueOf(txLevel); } }
@POST @Produces(MediaType.TEXT_PLAIN) @ApiOperation(value = "postTx: starts a new user Transaction in the current session") public Response postTx(String isolation) { TransactionManagement txMgr = getTxManager(); try { long txId = txMgr.beginTransaction(TransactionIsolation.valueOf(isolation)); return Response.created(UriBuilder.fromPath("/tx/" + txId).build()).entity(txId).build(); } catch (Exception ex) { logger.error("postTx.error", ex); throw new WebApplicationException(ex, Status.INTERNAL_SERVER_ERROR); } }
@Override public void readData(ObjectDataInput in) throws IOException { super.readData(in); txIsolation = TransactionIsolation.valueOf(in.readUTF()); }
@ManagedOperation(description="Starts new transaction") @ManagedOperationParameters({ @ManagedOperationParameter(name = "txIsolation", description = "Tx isolation level")}) public long beginTransaction(String txIsolation) { try { if (txIsolation == null || txIsolation.length() == 0) { return txMgr.beginTransaction(); } return txMgr.beginTransaction(TransactionIsolation.valueOf(txIsolation)); } catch (BagriException ex) { logger.error("beginTransaction.error: " + ex.getMessage(), ex); } return 0; }
@Override public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException { long txId; try { if (arguments.length > 0) { txId = txMgr.beginTransaction(TransactionIsolation.valueOf(arguments[0].head().getStringValue())); } else { txId = txMgr.beginTransaction(); } return new Int64Value(txId); } catch (BagriException ex) { throw new XPathException(ex); } } };