use of com.sun.messaging.jmq.jmsserver.data.TransactionList in project openmq by eclipse-ee4j.
the class TransactionManagerConfig method getNumTransactions.
public Integer getNumTransactions() {
TransactionList[] tls = Globals.getDestinationList().getTransactionList(null);
// PART
TransactionList tl = tls[0];
Vector transactions = tl.getTransactions(-1);
return (Integer.valueOf(transactions.size()));
}
use of com.sun.messaging.jmq.jmsserver.data.TransactionList in project openmq by eclipse-ee4j.
the class TransactionManagerConfig method doRollbackCommit.
public void doRollbackCommit(String transactionID, boolean rollback) throws MBeanException {
try {
long longTid = 0;
if (transactionID == null) {
throw new Exception("Null transaction ID");
}
try {
longTid = Long.parseLong(transactionID);
} catch (Exception e) {
throw new Exception("Invalid transaction ID: " + transactionID);
}
TransactionUID tid = new TransactionUID(longTid);
TransactionList[] tls = Globals.getDestinationList().getTransactionList(null);
TransactionList tl = null;
TransactionState ts = null;
for (int i = 0; i < tls.length; i++) {
tl = tls[i];
if (tl == null) {
continue;
}
ts = tl.retrieveState(tid);
if (ts == null) {
continue;
}
break;
}
if (ts == null) {
throw new Exception(rb.getString(rb.E_NO_SUCH_TRANSACTION, tid));
}
if (ts.getState() != TransactionState.PREPARED) {
throw new Exception(rb.getString(rb.E_TRANSACTION_NOT_PREPARED, tid));
}
JMQXid xid = tl.UIDToXid(tid);
if (xid == null) {
throw new Exception(rb.getString(rb.E_INTERNAL_BROKER_ERROR, "Could not find Xid for " + tid));
}
PacketRouter pr = Globals.getPacketRouter(0);
if (pr == null) {
throw new Exception(rb.getString(rb.E_INTERNAL_BROKER_ERROR, "Could not locate Packet Router"));
}
TransactionHandler thandler = (TransactionHandler) pr.getHandler(PacketType.ROLLBACK_TRANSACTION);
if (thandler == null) {
throw new Exception(rb.getString(rb.E_INTERNAL_BROKER_ERROR, "Could not locate Transaction Handler"));
}
if (rollback) {
thandler.doRollback(tl, tid, xid, null, ts, null, null, RollbackReason.ADMIN);
} else {
thandler.doCommit(tl, tid, xid, Integer.valueOf(XAResource.TMNOFLAGS), ts, null, false, null, null);
}
} catch (Exception e) {
String opName;
if (rollback) {
opName = TransactionOperations.ROLLBACK;
} else {
opName = TransactionOperations.COMMIT;
}
handleOperationException(opName, e);
}
}
use of com.sun.messaging.jmq.jmsserver.data.TransactionList in project openmq by eclipse-ee4j.
the class TransactionUtil method getUser.
public static String getUser(TransactionUID tid) {
TransactionList[] tls = Globals.getDestinationList().getTransactionList(null);
// PART
TransactionList tl = tls[0];
TransactionState ts;
if (tl == null) {
return (null);
}
ts = tl.retrieveState(tid);
if (ts == null) {
return (null);
}
return (ts.getUser());
}
use of com.sun.messaging.jmq.jmsserver.data.TransactionList in project openmq by eclipse-ee4j.
the class TransactionUtil method getNumAcks.
public static Long getNumAcks(TransactionUID tid) {
TransactionList[] tls = Globals.getDestinationList().getTransactionList(null);
// PART
TransactionList tl = tls[0];
if (tl == null) {
return (null);
}
return (Long.valueOf(tl.retrieveNConsumedMessages(tid)));
}
use of com.sun.messaging.jmq.jmsserver.data.TransactionList in project openmq by eclipse-ee4j.
the class TransactionUtil method getConnectionString.
public static String getConnectionString(TransactionUID tid) {
TransactionList[] tls = Globals.getDestinationList().getTransactionList(null);
// PART
TransactionList tl = tls[0];
TransactionState ts;
if (tl == null) {
return (null);
}
ts = tl.retrieveState(tid);
if (ts == null) {
return (null);
}
return (ts.getConnectionString());
}
Aggregations