@Override public void dispatchAsync(Command message) { if (!stopping.get()) { if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; TransmitCallback sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.onFailure(); } } } }
protected void processDispatch(Command command) throws IOException { MessageDispatch messageDispatch = (MessageDispatch) (command.isMessageDispatch() ? command : null); try { if (!stopping.get()) {
for (Iterator<Command> iter = dispatchQueue.iterator(); iter.hasNext(); ) { Command command = iter.next(); if (command.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) command; TransmitCallback sub = md.getTransmitCallback();
protected void serviceLocalCommand(Command command) { try { if (command.isMessageDispatch()) {
protected void serviceLocalCommand(Command command) { if (!disposed.get()) { try { if (command.isMessageDispatch()) { safeWaitUntilStarted(); networkBridgeStatistics.getEnqueues().increment();
protected void serviceRemoteCommand(Command command) { if (!disposed.get()) { try { if (command.isMessageDispatch()) { safeWaitUntilStarted(); MessageDispatch md = (MessageDispatch) command;
public void onActiveMQCommand(Command command) throws Exception { if (command.isResponse()) { Response response = (Response)command; Handler<Response> handler = responseHandlers.remove(new Integer(response.getCorrelationId())); if (handler != null) { handler.handle(response); } else { LOG.warn("No handler for response: " + response); } } else if (command.isMessageDispatch()) { MessageDispatch md = (MessageDispatch)command; Handler<MessageDispatch> handler = subscriptionsByConsumerId.get(md.getConsumerId()); if (handler != null) { handler.handle(md); } else { LOG.warn("No handler for message: " + md); } } }
public void dispatchAsync(Command message) { if (!stopping.get()) { // getStatistics().getEnqueues().increment(); if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; Runnable sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.run(); } } } }
@Override public void dispatchAsync(Command message) { if (!stopping.get()) { if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; TransmitCallback sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.onFailure(); } } } }
protected void processDispatch(Command command) throws IOException { final MessageDispatch messageDispatch = (MessageDispatch) (command.isMessageDispatch() ? command : null); try { if (!stopping.get()) { if (messageDispatch != null) { broker.preProcessDispatch(messageDispatch); } dispatch(command); } } finally { if (messageDispatch != null) { Runnable sub = messageDispatch.getTransmitCallback(); broker.postProcessDispatch(messageDispatch); if (sub != null) { sub.run(); } } // getStatistics().getDequeues().increment(); } }
@Override public void dispatchAsync(Command message) { if (!stopping.get()) { if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; TransmitCallback sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.onFailure(); } } } }
@Override public void dispatchAsync(Command message) { if (!stopping.get()) { if (taskRunner == null) { dispatchSync(message); } else { synchronized (dispatchQueue) { dispatchQueue.add(message); } try { taskRunner.wakeup(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } else { if (message.isMessageDispatch()) { MessageDispatch md = (MessageDispatch) message; TransmitCallback sub = md.getTransmitCallback(); broker.postProcessDispatch(md); if (sub != null) { sub.onFailure(); } } } }
protected void populateInitialHeaders(Map<String, Object> map) { Message message = null; if (command.isMessage()) { message = (Message) this.command; } if (command.isMessageDispatch()) { message = ((MessageDispatch) command).getMessage(); } if (message != null) { map.put("JMSCorrelationID", message.getCorrelationId()); map.put("JMSDestination", message.getDestination()); map.put("JMSExpiration", message.getExpiration()); map.put("JMSMessageID", message.getMessageId().toString()); map.put("JMSPriority", message.getPriority()); map.put("JMSRedelivered", message.isRedelivered()); map.put("JMSTimestamp", message.getTimestamp()); map.put("JMSReplyTo", message.getReplyTo()); map.put("JMSType", message.getType()); map.put("JMSXGroupID", message.getGroupID()); map.put("JMSXGroupSeq", message.getGroupSequence()); map.put("JMSXUserID", message.getUserID()); } } }
protected void processCommand(Object o) throws Exception { Command command = (Command) o; if (command.isResponse()) { LOG.error("Unexpected response " + command); } else if (command.isMessageDispatch()) { MessageDispatch messageDispatch = (MessageDispatch) command; ConsumerId consumerId = messageDispatch.getConsumerId(); MultiplexerInput input = consumerIdMultiplexerInputMap.get(consumerId); if (input != null) { input.oneway(messageDispatch); } else { LOG.debug("Couldn't find MultiplexerInput for consumerId:" + consumerId); } } else if (command.isBrokerInfo() || command.isWireFormatInfo()) { //not a lot to do with this } else if (command.getClass() == ConnectionError.class) { ConnectionError ce = (ConnectionError) command; onFailure(ce.getException()); } else { switch (command.getDataStructureType()) { case KeepAliveInfo.DATA_STRUCTURE_TYPE: case ShutdownInfo.DATA_STRUCTURE_TYPE: case ConnectionControl.DATA_STRUCTURE_TYPE: break; default: LOG.warn("Unexpected remote command: {}", command); } } }
protected void processCommand(Object o) throws Exception { Command command = (Command) o; if (command.isResponse()) { LOG.error("Unexpected response " + command); } else if (command.isMessageDispatch()) { MessageDispatch messageDispatch = (MessageDispatch) command; ConsumerId consumerId = messageDispatch.getConsumerId(); MultiplexerInput input = consumerIdMultiplexerInputMap.get(consumerId); if (input != null) { input.oneway(messageDispatch); } else { LOG.debug("Couldn't find MultiplexerInput for consumerId:" + consumerId); } } else if (command.isBrokerInfo() || command.isWireFormatInfo()) { //not a lot to do with this } else if (command.getClass() == ConnectionError.class) { ConnectionError ce = (ConnectionError) command; onFailure(ce.getException()); } else { switch (command.getDataStructureType()) { case KeepAliveInfo.DATA_STRUCTURE_TYPE: case ShutdownInfo.DATA_STRUCTURE_TYPE: case ConnectionControl.DATA_STRUCTURE_TYPE: break; default: LOG.warn("Unexpected remote command: {}", command); } } }
protected void processDispatch(Command command) throws IOException { MessageDispatch messageDispatch = (MessageDispatch) (command.isMessageDispatch() ? command : null); try { if (!stopping.get()) {
public ActiveMQDestination getDestination() { if (command.isMessage()) { return ((Message) command).getDestination(); } if (command.isMessageDispatch()) { return ((MessageDispatch) command).getDestination(); } if (command.isMessageAck()) { return ((MessageAck) command).getDestination(); } if (command instanceof ConsumerInfo) { return ((ConsumerInfo) command).getDestination(); } return null; }
protected void processDispatch(Command command) throws IOException { MessageDispatch messageDispatch = (MessageDispatch) (command.isMessageDispatch() ? command : null); try { if (!stopping.get()) { if (messageDispatch != null) { protocolManager.preProcessDispatch(messageDispatch); } dispatch(command); } } catch (IOException e) { if (messageDispatch != null) { TransmitCallback sub = messageDispatch.getTransmitCallback(); protocolManager.postProcessDispatch(messageDispatch); if (sub != null) { sub.onFailure(); } messageDispatch = null; throw e; } } finally { if (messageDispatch != null) { TransmitCallback sub = messageDispatch.getTransmitCallback(); protocolManager.postProcessDispatch(messageDispatch); if (sub != null) { sub.onSuccess(); } } } }
protected void serviceRemoteCommand(Command command) { try { if (command.isMessageDispatch()) { MessageDispatch md = (MessageDispatch)command; command = md.getMessage(); } if (command.getDataStructureType() == CommandTypes.SHUTDOWN_INFO) { LOG.warn("The Master has shutdown"); shutDown(); } else { boolean responseRequired = command.isResponseRequired(); int commandId = command.getCommandId(); if (responseRequired) { Response response = (Response)localBroker.request(command); response.setCorrelationId(commandId); remoteBroker.oneway(response); } else { localBroker.oneway(command); } } } catch (IOException e) { serviceRemoteException(e); } }
public void setDestination(ActiveMQDestination destination) { if (command.isMessage()) { Message message = (Message) command; if (message.getOriginalDestination() == null) { message.setOriginalDestination(message.getDestination()); } message.setDestination(destination); } if (command.isMessageDispatch()) { MessageDispatch messageDispatch = (MessageDispatch) command; Message message = messageDispatch.getMessage(); if (message.getOriginalDestination() == null) { message.setOriginalDestination(message.getDestination()); } message.setDestination(destination); messageDispatch.setDestination(destination); } if (command.isMessageAck()) { ((MessageAck) command).setDestination(destination); } if (command instanceof ConsumerInfo) { ((ConsumerInfo) command).setDestination(destination); } }