User: starksm 
  Date: 02/04/05 12:07:40

  Modified:    src/main/org/jboss/pool/jdbc/xa/wrapper Tag: Branch_2_4
                        XAConnectionImpl.java XADataSourceImpl.java
  Log:
  Apply fix for Bug #525840 and reduce logging threshold to trace for per
  connection messages
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +37 -1     
jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XAConnectionImpl.java
  
  Index: XAConnectionImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XAConnectionImpl.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- XAConnectionImpl.java     27 Dec 2001 20:36:33 -0000      1.2.2.1
  +++ XAConnectionImpl.java     5 Apr 2002 20:07:40 -0000       1.2.2.2
  @@ -55,6 +55,10 @@
       private TransactionListener transListener;
       private int preparedStatementCacheSize = 0;
       private int clientConnectionCount = 0;
  +    /** The JDBC user name used to open an underlying connection */
  +    private String user;
  +    /** The JDBC password used to open an underlying connection */
  +    private String password;
   
       /**
        * Creates a new transactional wrapper.
  @@ -233,5 +237,37 @@
               else
                   ((PoolEventListener)local.elementAt(i)).objectUsed(evt);
       }
  +    
  +    /** Getter for property password.
  +     * @return Value of property password.
  +     */
  +    public java.lang.String getPassword()
  +    {
  +       return password;
  +    }
  +    
  +    /** Setter for property password.
  +     * @param password New value of property password.
  +     */
  +    public void setPassword(java.lang.String password)
  +    {
  +       this.password = password;
  +    }
  +    
  +    /** Getter for property user.
  +     * @return Value of property user.
  +     */
  +    public java.lang.String getUser()
  +    {
  +       return user;
  +    }
  +    
  +    /** Setter for property user.
  +     * @param user New value of property user.
  +     */
  +    public void setUser(java.lang.String user)
  +    {
  +       this.user = user;
  +    }
  +    
   }
  -
  
  
  
  1.1.1.1.2.2 +32 -12    
jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XADataSourceImpl.java
  
  Index: XADataSourceImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/jdbc/xa/wrapper/Attic/XADataSourceImpl.java,v
  retrieving revision 1.1.1.1.2.1
  retrieving revision 1.1.1.1.2.2
  diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2
  --- XADataSourceImpl.java     4 Mar 2002 23:35:09 -0000       1.1.1.1.2.1
  +++ XADataSourceImpl.java     5 Apr 2002 20:07:40 -0000       1.1.1.1.2.2
  @@ -159,8 +159,8 @@
         XAConnectionImpl xacon = new XAConnectionImpl(con, res);
         res.setXAConnection(xacon);
   
  -      if( log.isDebugEnabled() )
  -         log.debug( "created new Connection(" + con.getClass().getName() + ") with 
XAResource " + res.getClass().getName() + " and XAConnection " + 
xacon.getClass().getName() + "." );
  +      if( log.isTraceEnabled() )
  +         log.trace("created new Connection(" + con.getClass().getName() + ") with 
XAResource " + res.getClass().getName() + " and XAConnection " + 
xacon.getClass().getName() + "." );
   
         return xacon;
      }
  @@ -168,16 +168,36 @@
       /**
        * Gets an XAConnection.  This first gets a java.sql.Connection from the
        * underlying driver, and then wraps it in an XAConnection and XAResource.
  -     * This first sets the default user name and password to the values you
  -     * specify.  Then it uses those, the URL, and properties (or as many as you
  -     * have specified) to make the connection.
  +     * Note that we never change the default userid and password, but instead
  +     * only set the userid and password for this one connection.
        */
  -    public XAConnection getXAConnection(String user, String password) throws 
SQLException {
  -        this.user = user;
  -        this.password = password;
  -        return getXAConnection();
  +    public XAConnection getXAConnection(String user, String password) throws 
SQLException
  +    {
  +       Connection con = DriverManager.getConnection(url, user, password);
  +
  +       try
  +       {
  +           con.setAutoCommit(false);
  +       }
  +       catch(SQLException e)
  +       {
  +           if(logWriter != null)
  +               logWriter.println("XADataSource unable to disable auto-commit on 
"+con.getClass().getName());
  +       }
  +
  +       XAResourceImpl res = new XAResourceImpl(con);
  +       XAConnectionImpl xacon = new XAConnectionImpl(con, res);
  +       res.setXAConnection(xacon);
  +
  +       xacon.setUser(user);
  +       xacon.setPassword(password);
  +       if( log.isTraceEnabled() )
  +       {
  +         log.trace(" created new Connection ("+con.getClass().getName()+") with 
XAResource "
  +            + res.getClass().getName()+" and XAConnection with userid and password "
  +            + xacon.getClass().getName());
  +       }
  +
  +       return xacon;
       }
   }
  -/*
  -vim:tabstop=3:et:shiftwidth=3
  -*/
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to