code: public Destination createDestination(String name,
                                    DestinationType type,
                                    boolean fTransacted,
                                    int ackMode) throws MessagingException {
          // If the destination already exists, just return it
          JMSDestination jmsDest = jmsDestinations.get(name);
          if (jmsDest != null) {
              return jmsDest.destination;
          }
  
          // Create the new destination and store it
          Session session;
          try {
              session = connection.createSession(fTransacted, ackMode);
          } catch (JMSException e) {
              throw new MessagingException(e.getMessage(), e);
          }
  
          // Look up the destination otherwise create it
          Destination destination = null;
          try {
              destination = (Destination) jndiLookup(name);
          } catch (MessagingException me) {
              logger.debug("JNDI lookup for destination " + name + " failed. "
                      + "Destination must be created.");
              destination = null;
          }
          if (destination == null) {
              // Create a topic or queue as specified
              try {
                  if (type.equals(DestinationType.Queue)) {
                      logger.debug("setupDestination() - creating Queue" + name);
                      destination = session.createQueue(name);
                  } else {
                      logger.debug("setupDestination() - creating Topic " + name);
                      destination = session.createTopic(name);
                  }
              } catch (JMSException e) {
                  throw new MessagingException(e.getMessage(), e);
              }
          }
  
          jmsDest = new JMSDestination(destination, session, null, null);
  
          jmsDestinations.put(name, jmsDest);
  
          return destination;
      }
docs: Creates a Destination if the Destination has not already been created.
  
  @param name - the name of the destination to create
  @param type - the destination type (topic or queue)
  @param fTransacted - determines whether the session will maintain transactions
  @param ackMode - determines the session acknowledgment mode
  @throws MessagingException