/** * Create an instance of {@link TransactionStatisticsElement } * */ public TransactionStatisticsElement createTransactionStatisticsElement() { return new TransactionStatisticsElement(); }
/** * Create an instance of {@link TransactionManagerElement } * */ public TransactionManagerElement createTransactionManagerElement() { return new TransactionManagerElement(); }
/** * Create an instance of {@link TwoPhaseAwareParticipantElement } * */ public TwoPhaseAwareParticipantElement createTwoPhaseAwareParticipantElement() { return new TwoPhaseAwareParticipantElement(); }
URI volatileURI = TxSupport.getUri(info, info.getPathSegments().size(), TxLinkNames.VOLATILE_PARTICIPANT); coordinatorElement.setTxnURI(txnURI); coordinatorElement.setTerminateURI(terminateURI.toASCIIString()); coordinatorElement.setDurableParticipantEnlistmentURI(txnURI); coordinatorElement.setVolatileParticipantEnlistmentURI(volatileURI.toASCIIString()); String participantURI = participantInfo.get(TxLinkNames.PARTICIPANT_RESOURCE); String recoveryURI = participantInfo.get(TxLinkNames.PARTICIPANT_RECOVERY); TwoPhaseAwareParticipantElement participantElement = new TwoPhaseAwareParticipantElement(); participantElement.setTerminatorURI(terminatorURI); participantElement.setRecoveryURI(recoveryURI); participantElement.setResourceURI(participantURI); txn.getStatus(participantElement, participantURI); coordinatorElement.addTwoPhaseAware(participantElement);
public CoordinatorElement toXML() { CoordinatorElement coordinatorElement = new CoordinatorElement(); coordinatorElement.setCreated(new Date(System.currentTimeMillis() - age)); coordinatorElement.setStatus(TransactionStatusElement.valueOf(getStatus())); coordinatorElement.setTimeout(getTimeout()); for (String vParticipant : volatileParticipants) coordinatorElement.addVolatileParticipant(vParticipant); return coordinatorElement; }
/** * 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; }
/** * Create an instance of {@link CoordinatorElement } * */ public CoordinatorElement createCoordinatorElement() { return new CoordinatorElement(); }
public boolean getStatus(TwoPhaseAwareParticipantElement participantElement, String participantUrl) { RESTRecord rr = findParticipant(participantUrl); if (rr == null) return false; try { participantElement.setStatus(TransactionStatusElement.valueOf(rr.getStatus())); } catch (IllegalArgumentException e) { participantElement.setStatus(TransactionStatusElement.TransactionStatusNone); } participantElement.setCreated(new Date(rr.getAge())); return true; }
/** * Create an instance of {@link ParticipantElement } * */ public ParticipantElement createParticipantElement() { return new ParticipantElement(); }
/** * Create an instance of {@link TwoPhaseUnawareParticipantElement } * */ public TwoPhaseUnawareParticipantElement createTwoPhaseUnawareParticipantElement() { return new TwoPhaseUnawareParticipantElement(); }
/** * Create an instance of {@link TransactionStatisticsElement } * */ public TransactionStatisticsElement createTransactionStatisticsElement() { return new TransactionStatisticsElement(); }
/** * Create an instance of {@link TransactionManagerElement } * */ public TransactionManagerElement createTransactionManagerElement() { return new TransactionManagerElement(); }
/** * Create an instance of {@link TwoPhaseAwareParticipantElement } * */ public TwoPhaseAwareParticipantElement createTwoPhaseAwareParticipantElement() { return new TwoPhaseAwareParticipantElement(); }
/** * Create an instance of {@link CoordinatorElement } * */ public CoordinatorElement createCoordinatorElement() { return new CoordinatorElement(); }
/** * Create an instance of {@link ParticipantElement } * */ public ParticipantElement createParticipantElement() { return new ParticipantElement(); }
/** * Create an instance of {@link TwoPhaseUnawareParticipantElement } * */ public TwoPhaseUnawareParticipantElement createTwoPhaseUnawareParticipantElement() { return new TwoPhaseUnawareParticipantElement(); }
/** * 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()); }