commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger SessionFactory.java
Date Tue, 26 Nov 2002 18:25:46 GMT
jstrachan    2002/11/26 10:25:46

  Modified:    messenger/src/java/org/apache/commons/messenger
                        SessionFactory.java
  Log:
  Added support for explicitly setting the clientID of a JMS connection in the XML configuration
file.
  
  <messenger name="foo">
    <factory clientID="myClientID" ...>
  
  or 
  
  <messenger name="foo">
    <jndi clientID="myClientID" ...>
  
  
  Revision  Changes    Path
  1.15      +27 -3     jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/SessionFactory.java
  
  Index: SessionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messenger/SessionFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SessionFactory.java	12 Nov 2002 12:38:06 -0000	1.14
  +++ SessionFactory.java	26 Nov 2002 18:25:45 -0000	1.15
  @@ -62,6 +62,9 @@
       /** Whether to use a Topic or Queue connection/session */
       private boolean topic = true;
   
  +    /** The client ID for the connection */
  +    private String clientID;
  +    
       /** Creates a new Session instance */
       public Session createSession(Connection connection) throws JMSException {
           if ( log.isDebugEnabled() ) {
  @@ -138,7 +141,7 @@
           return connection;
       }
   
  -    public void setConnection(Connection connection) {
  +    public void setConnection(Connection connection) throws JMSException {
           this.connection = connection;
           // change the topic flag if the wrong topic/queue type
           if (topic) {
  @@ -151,6 +154,11 @@
                   setTopic(true);
               }
           }
  +        
  +        // assign a clientID if one is set
  +        if (clientID != null) {
  +            connection.setClientID(clientID);                
  +        }
       }
   
       /** Returns the JMS ConnectionFactory used to create a new connection */
  @@ -261,6 +269,22 @@
       /** Sets whether to use a Topic or Queue connection/session */
       public void setTopic(boolean topic) {
           this.topic = topic;
  +    }
  +
  +    /**
  +     * Returns the clientID used on the current connection.
  +     * @return String
  +     */
  +    public String getClientID() {
  +        return clientID;
  +    }
  +
  +    /**
  +     * Sets the clientID used on the current connection.
  +     * @param clientID The clientID to set
  +     */
  +    public void setClientID(String clientID) {
  +        this.clientID = clientID;
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message