/** * Creates a <code>MessageDestination</code> instance, sets its id, sets it manageable * if the <code>AbstractService</code> that created it is manageable, * and sets its <code>Service</code> to the <code>AbstractService</code> that * created it. * * @param id The id of the <code>MessageDestination</code>. * @return The <code>Destination</code> instanced created. */ public Destination createDestination(String id) { MessageDestination destination = new MessageDestination(); destination.setId(id); destination.setManaged(isManaged()); destination.setService(this); return destination; }
/** * Used to increment the message count metric for the <code>MessageService</code>. This value is * stored in the corresponding MBean. The <code>MessageService</code> already invokes this method * in its <code>serviceMessage()</code> and <code>serviceCommand()</code> implementations, but if * a subclass overrides these methods completely it should invoke this method appropriately as * it processes messages. * * @param commandMessage Pass <code>true</code> if the message being processed is a <code>CommandMessage</code>; * otherwise <code>false</code>. */ protected void incrementMessageCount(boolean commandMessage, Message message) { // Update management metrics. if (isManaged()) { MessageDestination destination = (MessageDestination)getDestination(message.getDestination()); if (destination != null && destination.isManaged()) { MessageDestinationControl destinationControl = (MessageDestinationControl)destination.getControl(); if (destinationControl != null) // Should not happen but just in case. { if (commandMessage) destinationControl.incrementServiceCommandCount(); else destinationControl.incrementServiceMessageCount(); } } } }
/** * Creates a <code>MessageDestination</code> instance, sets its id, sets it manageable * if the <code>AbstractService</code> that created it is manageable, * and sets its <code>Service</code> to the <code>AbstractService</code> that * created it. * * @param id The id of the <code>MessageDestination</code>. * @return The <code>Destination</code> instanced created. */ @Override public Destination createDestination(String id) { if (id == null) { // Cannot add ''{0}'' with null id to the ''{1}'' ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"Destination", "Service"}); throw ex; } // check with the message broker to make sure that no destination with the id already exists getMessageBroker().isDestinationRegistered(id, getId(), true); MessageDestination destination = new MessageDestination(); destination.setId(id); destination.setManaged(isManaged()); destination.setService(this); return destination; }
/** * Creates a <code>MessageDestination</code> instance, sets its id, sets it manageable * if the <code>AbstractService</code> that created it is manageable, * and sets its <code>Service</code> to the <code>AbstractService</code> that * created it. * * @param id The id of the <code>MessageDestination</code>. * @return The <code>Destination</code> instanced created. */ @Override public Destination createDestination(String id) { if (id == null) { // Cannot add ''{0}'' with null id to the ''{1}'' ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.NULL_COMPONENT_ID, new Object[]{"Destination", "Service"}); throw ex; } // check with the message broker to make sure that no destination with the id already exists getMessageBroker().isDestinationRegistered(id, getId(), true); MessageDestination destination = new MessageDestination(); destination.setId(id); destination.setManaged(isManaged()); destination.setService(this); return destination; }