messagingStats.getOutboundExchanges().increment(); messagingStats.getOutboundExchangeRate().addTime(currentTime - lastSendTime);
if (container.isNotifyStatistics()) { long oldCount = messagingStats.getOutboundExchanges().getCount(); messagingStats.getOutboundExchanges().increment(); componentConnector.getComponentMBean().firePropertyChanged( "outboundExchangeCount", new Long(oldCount), new Long(messagingStats.getOutboundExchanges().getCount())); double oldRate = messagingStats.getOutboundExchangeRate().getAverageTime(); messagingStats.getOutboundExchangeRate().addTime(currentTime - lastSendTime); componentConnector.getComponentMBean().firePropertyChanged("outboundExchangeRate", new Double(oldRate), new Double(messagingStats.getOutboundExchangeRate().getAverageTime())); } else { messagingStats.getOutboundExchanges().increment(); messagingStats.getOutboundExchangeRate().addTime(currentTime - lastSendTime); }
    protected void doSend(MessageExchangeImpl messageExchange, boolean sync) throws MessagingException {        try {            // If the delivery channel has been closed            checkNotClosed();            // If the message has timed out            if (messageExchange.getPacket().isAborted()) {                throw new ExchangeTimeoutException(messageExchange);            }            // Auto enlist exchange in transaction            autoEnlistInTx(messageExchange);            // Update persistence info            Boolean persistent = messageExchange.getPersistent();            if (persistent == null) {            	if (context.getActivationSpec().getPersistent() != null) {            		persistent = context.getActivationSpec().getPersistent();            	} else {            		persistent = Boolean.valueOf(context.getContainer().isPersistent());            	}            	messageExchange.setPersistent(persistent);            }                        if (exchangeThrottling) {                if (throttlingInterval > intervalCount) {                    intervalCount = 0;                    try {                        Thread.sleep(throttlingTimeout);                    }                    catch (InterruptedException e) {                        log.warn("throttling failed", e);                    }                }                intervalCount++;            }                        long currentTime = System.currentTimeMillis();            messagingStats.getOutboundExchanges().increment();            messagingStats.getOutboundExchangeRate().addTime(currentTime - lastSendTime);            lastSendTime = currentTime;            if (messageExchange.getRole() == Role.CONSUMER) {                messageExchange.setSourceId(componentConnector.getComponentNameSpace());            }                // Call the listeners before the ownership changes            container.callListeners(messageExchange);            messageExchange.handleSend(sync);            container.sendExchange(messageExchange.getMirror());        } catch (MessagingException e) {            if (log.isDebugEnabled()) {                log.debug("Exception processing: " + messageExchange.getExchangeId() + " in " + this);            }            throw e;        } finally {            if (messageExchange.getTransactionContext() != null) {                if (messageExchange.getMirror().getSyncState() == MessageExchangeImpl.SYNC_STATE_SYNC_SENT) {                    suspendTx(messageExchange);                    if (log.isDebugEnabled()) {                        log.debug("Notifying: " + messageExchange.getExchangeId() + " in " + this);                    }                    synchronized (messageExchange.getMirror()) {                        messageExchange.getMirror().notify();                    }                }            }        }                /*        if (messageExchange.getMirror().getSyncState() == MessageExchangeImpl.SYNC_STATE_SYNC_SENT) {            synchronized (messageExchange.getMirror()) {                suspendTx(messageExchange);                messageExchange.getMirror().setSyncState(MessageExchangeImpl.SYNC_STATE_SYNC_RECEIVED);                messageExchange.getMirror().notify();            }        }        */    }