/** * Create an instance of {@link TransactionStatisticsElement } * */ public TransactionStatisticsElement createTransactionStatisticsElement() { return new TransactionStatisticsElement(); }
/** * Create an instance of {@link TransactionStatisticsElement } * */ public TransactionStatisticsElement createTransactionStatisticsElement() { return new TransactionStatisticsElement(); }
/** * Performing a GET on the transaction-manager URI sufficed with /statistics * returns statistics of the transaction manager. * Numbers of active, prepared, committed, and aborted transactions are returned. * * @return TransactionStatisticsElement */ @GET @Path(TxSupport.TX_SEGMENT + TxLinkNames.STATISTICS) @Produces(TxMediaType.TX_STATUS_EXT_MEDIA_TYPE) public TransactionStatisticsElement getTransactionStatistics() { // TODO: for prepared we could go through every transaction and get its status return new TransactionStatisticsElement( active.get(), prepared.get(), committed.get(), aborted.get()); }
/** * Performing a GET on the transaction-manager URI with media type application/txstatusext+xml * returns extended information about the transaction-manager resource such as how long it has * been up and all transaction-coordinator URIs. * * @param info Request context * @return TransactionManagerElement */ @GET @Path(TxSupport.TX_SEGMENT) @Produces(TxMediaType.TX_STATUS_EXT_MEDIA_TYPE) public TransactionManagerElement getTransactionManagerInfo(@Context UriInfo info) { TransactionManagerElement tm = new TransactionManagerElement(); updateTransactions(); for (String s : transactions.keySet()) { URI uri = TxSupport.getUri(info, info.getPathSegments().size(), s); tm.addCoordinator(uri.toASCIIString()); } tm.setCreated(new Date(age)); tm.setStatistics(new TransactionStatisticsElement( active.get(), prepared.get(), committed.get(), aborted.get())); return tm; }