return txDetailListJson.toString();
}
public String listPreparedTransactionDetailsAsHTML() throws Exception
{
ResourceManager resourceManager = server.getResourceManager();
Map<Xid, Long> xids = resourceManager.getPreparedTransactionsWithCreationTime();
if (xids == null || xids.size() == 0)
{
return "<h3>*** Prepared Transaction Details ***</h3><p>No entry.</p>";
}
ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<Map.Entry<Xid, Long>>(xids.entrySet());
Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>()
{
public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2)
{
// sort by creation time, oldest first
return (int)(entry1.getValue() - entry2.getValue());
}
});
StringBuilder html = new StringBuilder();
html.append("<h3>*** Prepared Transaction Details ***</h3>");
for (Map.Entry<Xid, Long> entry : xidsSortedByCreationTime)
{
Xid xid = entry.getKey();
TransactionDetail detail = new JMSTransactionDetail(xid, resourceManager.getTransaction(xid), entry.getValue());
JSONObject txJson = detail.toJSON();
html.append("<table border=\"1\">");
html.append("<tr><th>creation_time</th>");
html.append("<td>" + txJson.get(TransactionDetail.KEY_CREATION_TIME) + "</td>");