本文整理了Java中org.apache.activemq.command.Message.setMemoryUsage()
方法的一些代码示例,展示了Message.setMemoryUsage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setMemoryUsage()
方法的具体详情如下:
包路径:org.apache.activemq.command.Message
类名称:Message
方法名:setMemoryUsage
暂无
代码示例来源:origin: apache/activemq
@Override
public synchronized LinkedList<MessageReference> pageInList(int maxItems) {
LinkedList<MessageReference> result = new LinkedList<MessageReference>();
int count = 0;
for (Iterator<MessageReference> i = memoryList.iterator(); i.hasNext() && count < maxItems;) {
MessageReference ref = i.next();
ref.incrementReferenceCount();
result.add(ref);
count++;
}
if (count < maxItems && !isDiskListEmpty()) {
for (Iterator<MessageReference> i = new DiskIterator(); i.hasNext() && count < maxItems;) {
Message message = (Message) i.next();
message.setRegionDestination(regionDestination);
message.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
message.incrementReferenceCount();
result.add(message);
count++;
}
}
return result;
}
代码示例来源:origin: apache/activemq
/**
* @return the next pending message
*/
@Override
public synchronized MessageReference next() {
MessageReference reference = iter.next();
last = reference;
if (!isDiskListEmpty()) {
// got from disk
reference.getMessage().setRegionDestination(regionDestination);
reference.getMessage().setMemoryUsage(this.getSystemUsage().getMemoryUsage());
}
reference.incrementReferenceCount();
return reference;
}
代码示例来源:origin: apache/activemq
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception {
Message forwardedMessage = message.copy();
forwardedMessage.setMemoryUsage(null);
forwardedMessage.setOriginalDestination( message.getDestination() );
forwardedMessage.setDestination(destination);
// Send it back through the region broker for routing.
context.setMutable(true);
regionBroker.send(context, forwardedMessage);
}
}
代码示例来源:origin: apache/activemq
public void send(ProducerBrokerExchange context, Message message) throws Exception {
message.setDestination(mirrorDestination.getActiveMQDestination());
mirrorDestination.send(context, message);
if (isCopyMessage()) {
message = message.copy();
}
message.setDestination(destination.getActiveMQDestination());
message.setMemoryUsage(null); // set this to null so that it will use the queue memoryUsage instance instead of the topic.
super.send(context, message);
}
};
代码示例来源:origin: apache/activemq
@Override
public Response processMessageDispatch(MessageDispatch md) throws Exception {
waitForTransportInterruptionProcessingToComplete();
ActiveMQDispatcher dispatcher = dispatchers.get(md.getConsumerId());
if (dispatcher != null) {
// Copy in case a embedded broker is dispatching via
// vm://
// md.getMessage() == null to signal end of queue
// browse.
Message msg = md.getMessage();
if (msg != null) {
msg = msg.copy();
msg.setReadOnlyBody(true);
msg.setReadOnlyProperties(true);
msg.setRedeliveryCounter(md.getRedeliveryCounter());
msg.setConnection(ActiveMQConnection.this);
msg.setMemoryUsage(null);
md.setMessage(msg);
}
dispatcher.dispatch(md);
} else {
LOG.debug("{} no dispatcher for {} in {}", this, md, dispatchers);
}
return null;
}
代码示例来源:origin: apache/activemq
/**
*
*/
public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception {
ActiveMQDestination destination = message.getDestination();
if (destination.isComposite()) {
ActiveMQDestination[] destinations = destination.getCompositeDestinations();
for (int i = 0; i < destinations.length; i++) {
if (i != 0) {
message = message.copy();
message.setMemoryUsage(null);
}
message.setOriginalDestination(destination);
message.setDestination(destinations[i]);
next.send(producerExchange, message);
}
} else {
next.send(producerExchange, message);
}
}
代码示例来源:origin: apache/activemq
if (!cached) {
if( message.getMemoryUsage()==null ) {
message.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
代码示例来源:origin: apache/activemq
private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
if (LOG.isTraceEnabled()) {
Destination regionDestination = (Destination) messageReference.getRegionDestination();
LOG.trace("redelivery #{} of: {} with delay: {}, dest: {}", new Object[]{
redeliveryCount, messageReference.getMessageId(), delay, regionDestination.getActiveMQDestination()
});
}
final Message old = messageReference.getMessage();
Message message = old.copy();
message.setTransactionId(null);
message.setMemoryUsage(null);
message.removeProperty(ScheduledMessage.AMQ_SCHEDULED_ID);
message.setProperty(REDELIVERY_DELAY, delay);
message.setProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
message.setRedeliveryCounter(redeliveryCount);
boolean originalFlowControl = context.isProducerFlowControl();
try {
context.setProducerFlowControl(false);
ProducerInfo info = new ProducerInfo();
ProducerState state = new ProducerState(info);
ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
producerExchange.setProducerState(state);
producerExchange.setMutable(true);
producerExchange.setConnectionContext(context);
context.getBroker().send(producerExchange, message);
} finally {
context.setProducerFlowControl(originalFlowControl);
}
}
代码示例来源:origin: apache/activemq
protected Message configureMessage(MessageDispatch md) throws IOException {
Message message = md.getMessage().copy();
// Update the packet to show where it came from.
message.setBrokerPath(appendToBrokerPath(message.getBrokerPath(), localBrokerPath));
message.setProducerId(producerInfo.getProducerId());
message.setDestination(md.getDestination());
message.setMemoryUsage(null);
if (message.getOriginalTransactionId() == null) {
message.setOriginalTransactionId(message.getTransactionId());
}
message.setTransactionId(null);
if (configuration.isUseCompression()) {
message.compress();
}
return message;
}
代码示例来源:origin: apache/activemq
public static void doResend(final ConnectionContext context, Message originalMessage, ActiveMQDestination deadLetterDestination, boolean copy) throws Exception {
Message message = copy ? originalMessage.copy() : originalMessage;
message.setOriginalDestination(message.getDestination());
message.setOriginalTransactionId(message.getTransactionId());
message.setDestination(deadLetterDestination);
message.setTransactionId(null);
message.setMemoryUsage(null);
message.setRedeliveryCounter(0);
message.getMessageId().setDataLocator(null);
boolean originalFlowControl = context.isProducerFlowControl();
try {
context.setProducerFlowControl(false);
ProducerInfo info = new ProducerInfo();
ProducerState state = new ProducerState(info);
ProducerBrokerExchange producerExchange = new ProducerBrokerExchange();
producerExchange.setProducerState(state);
producerExchange.setMutable(true);
producerExchange.setConnectionContext(context);
context.getBroker().send(producerExchange, message);
} finally {
context.setProducerFlowControl(originalFlowControl);
}
}
代码示例来源:origin: pierre/meteo
/**
* @return the next pending message
*/
@Override
public synchronized MessageReference next() {
Message message = (Message) iter.next();
last = message;
if (!isDiskListEmpty()) {
// got from disk
message.setRegionDestination(regionDestination);
message.setMemoryUsage(this.getSystemUsage().getMemoryUsage());
}
message.incrementReferenceCount();
return message;
}
代码示例来源:origin: org.apache.activemq/activemq-broker
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception {
Message forwardedMessage = message.copy();
forwardedMessage.setMemoryUsage(null);
forwardedMessage.setOriginalDestination( message.getDestination() );
forwardedMessage.setDestination(destination);
// Send it back through the region broker for routing.
context.setMutable(true);
regionBroker.send(context, forwardedMessage);
}
}
代码示例来源:origin: org.apache.activemq/activemq-broker
/**
* @return the next pending message
*/
@Override
public synchronized MessageReference next() {
MessageReference reference = iter.next();
last = reference;
if (!isDiskListEmpty()) {
// got from disk
reference.getMessage().setRegionDestination(regionDestination);
reference.getMessage().setMemoryUsage(this.getSystemUsage().getMemoryUsage());
}
reference.incrementReferenceCount();
return reference;
}
代码示例来源:origin: org.apache.activemq/activemq-all
/**
* @return the next pending message
*/
@Override
public synchronized MessageReference next() {
MessageReference reference = iter.next();
last = reference;
if (!isDiskListEmpty()) {
// got from disk
reference.getMessage().setRegionDestination(regionDestination);
reference.getMessage().setMemoryUsage(this.getSystemUsage().getMemoryUsage());
}
reference.incrementReferenceCount();
return reference;
}
代码示例来源:origin: org.apache.activemq/activemq-all
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception {
Message forwardedMessage = message.copy();
forwardedMessage.setMemoryUsage(null);
forwardedMessage.setOriginalDestination( message.getDestination() );
forwardedMessage.setDestination(destination);
// Send it back through the region broker for routing.
context.setMutable(true);
regionBroker.send(context, forwardedMessage);
}
}
代码示例来源:origin: org.apache.activemq/activemq-osgi
private void doForward(ProducerBrokerExchange context, Message message, Broker regionBroker, ActiveMQDestination destination) throws Exception {
Message forwardedMessage = message.copy();
forwardedMessage.setMemoryUsage(null);
forwardedMessage.setOriginalDestination( message.getDestination() );
forwardedMessage.setDestination(destination);
// Send it back through the region broker for routing.
context.setMutable(true);
regionBroker.send(context, forwardedMessage);
}
}
代码示例来源:origin: org.apache.activemq/activemq-broker
public void send(ProducerBrokerExchange context, Message message) throws Exception {
message.setDestination(mirrorDestination.getActiveMQDestination());
mirrorDestination.send(context, message);
if (isCopyMessage()) {
message = message.copy();
}
message.setDestination(destination.getActiveMQDestination());
message.setMemoryUsage(null); // set this to null so that it will use the queue memoryUsage instance instead of the topic.
super.send(context, message);
}
};
代码示例来源:origin: org.apache.activemq/activemq-all
public void send(ProducerBrokerExchange context, Message message) throws Exception {
message.setDestination(mirrorDestination.getActiveMQDestination());
mirrorDestination.send(context, message);
if (isCopyMessage()) {
message = message.copy();
}
message.setDestination(destination.getActiveMQDestination());
message.setMemoryUsage(null); // set this to null so that it will use the queue memoryUsage instance instead of the topic.
super.send(context, message);
}
};
代码示例来源:origin: org.apache.activemq/activemq-osgi
public void send(ProducerBrokerExchange context, Message message) throws Exception {
message.setDestination(mirrorDestination.getActiveMQDestination());
mirrorDestination.send(context, message);
if (isCopyMessage()) {
message = message.copy();
}
message.setDestination(destination.getActiveMQDestination());
message.setMemoryUsage(null); // set this to null so that it will use the queue memoryUsage instance instead of the topic.
super.send(context, message);
}
};
代码示例来源:origin: org.apache.activemq/activemq-all
protected Message configureMessage(MessageDispatch md) throws IOException {
Message message = md.getMessage().copy();
// Update the packet to show where it came from.
message.setBrokerPath(appendToBrokerPath(message.getBrokerPath(), localBrokerPath));
message.setProducerId(producerInfo.getProducerId());
message.setDestination(md.getDestination());
message.setMemoryUsage(null);
if (message.getOriginalTransactionId() == null) {
message.setOriginalTransactionId(message.getTransactionId());
}
message.setTransactionId(null);
if (configuration.isUseCompression()) {
message.compress();
}
return message;
}
内容来源于网络,如有侵权,请联系作者删除!