本文整理匯總了Java中javax.jms.JMSException.getLinkedException方法的典型用法代碼示例。如果您正苦於以下問題:Java JMSException.getLinkedException方法的具體用法?Java JMSException.getLinkedException怎麽用?Java JMSException.getLinkedException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.jms.JMSException
的用法示例。
在下文中一共展示了JMSException.getLinkedException方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLoyalty
import javax.jms.JMSException; //導入方法依賴的package包/類
@GET
@Path("/")
@Produces("application/json")
public JsonObject getLoyalty(@QueryParam("owner") String owner, @QueryParam("loyalty") String oldLoyalty, @QueryParam("total") double total) {
JsonObjectBuilder loyaltyLevel = Json.createObjectBuilder();
String loyalty = "Basic";
if (total > 1000000.00) {
loyalty = "Platinum";
} else if (total > 100000.00) {
loyalty = "Gold";
} else if (total > 50000.00) {
loyalty = "Silver";
} else if (total > 10000.00) {
loyalty = "Bronze";
}
if (!loyalty.equals(oldLoyalty)) try {
JsonObjectBuilder builder = Json.createObjectBuilder();
builder.add("owner", owner);
builder.add("old", oldLoyalty);
builder.add("new", loyalty);
JsonObject message = builder.build();
invokeJMS(message);
} catch (JMSException jms) { //in case MQ is not configured, just log the exception and continue
jms.printStackTrace();
Exception linked = jms.getLinkedException();
if (linked != null) linked.printStackTrace();
} catch (Throwable t) { //in case MQ is not configured, just log the exception and continue
t.printStackTrace();
}
loyaltyLevel.add("owner", owner);
loyaltyLevel.add("loyalty", loyalty);
return loyaltyLevel.build();
}