本文整理了Java中org.apache.activemq.artemis.api.core.Message.isExpired()
方法的一些代码示例,展示了Message.isExpired()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.isExpired()
方法的具体详情如下:
包路径:org.apache.activemq.artemis.api.core.Message
类名称:Message
方法名:isExpired
[英]Returns whether this message is expired or not.
[中]返回此消息是否过期。
代码示例来源:origin: apache/activemq-artemis
private boolean checkExpired(final MessageReference reference) {
try {
if (reference.getMessage().isExpired()) {
if (logger.isTraceEnabled()) {
logger.trace("Reference " + reference + " is expired");
}
reference.handled();
try {
expire(reference);
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorExpiringRef(e);
}
return true;
} else {
return false;
}
} catch (Throwable e) {
ActiveMQServerLogger.LOGGER.unableToCheckIfMessageExpired(e);
return false;
}
}
代码示例来源:origin: apache/activemq-artemis
@Test
public void testExpired() {
Message message = new ClientMessageImpl();
Assert.assertEquals(0, message.getExpiration());
Assert.assertFalse(message.isExpired());
message.setExpiration(System.currentTimeMillis() + 1000);
Assert.assertFalse(message.isExpired());
message.setExpiration(System.currentTimeMillis() - 1);
Assert.assertTrue(message.isExpired());
message.setExpiration(System.currentTimeMillis() - 1000);
Assert.assertTrue(message.isExpired());
message.setExpiration(0);
Assert.assertFalse(message.isExpired());
}
代码示例来源:origin: apache/activemq-artemis
hasElements = true;
MessageReference ref = iter.next();
if (ref.getMessage().isExpired()) {
incDelivering(ref);
expired = true;
内容来源于网络,如有侵权,请联系作者删除!