Subversion Repositories DevTools

Rev

Rev 846 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 846 Rev 850
Line 17... Line 17...
17
import java.util.Date;
17
import java.util.Date;
18
import java.util.GregorianCalendar;
18
import java.util.GregorianCalendar;
19
import java.util.Iterator;
19
import java.util.Iterator;
20
import java.util.ListIterator;
20
import java.util.ListIterator;
21
import java.util.Vector;
21
import java.util.Vector;
-
 
22
import java.util.concurrent.locks.ReentrantLock;
22
 
23
 
23
import oracle.jdbc.driver.OracleDriver;
24
import oracle.jdbc.OracleDriver;
24
 
25
 
25
import org.apache.log4j.Logger;
26
import org.apache.log4j.Logger;
26
 
27
 
27
/**Release Manager schema abstraction
28
/**Release Manager schema abstraction
28
 */
29
 */
Line 82... Line 83...
82
  private static final Logger mLogger = Logger.getLogger(ReleaseManager.class);
83
  private static final Logger mLogger = Logger.getLogger(ReleaseManager.class);
83
 
84
 
84
  /**database session handle
85
  /**database session handle
85
   * @attribute
86
   * @attribute
86
   */
87
   */
87
  private Connection mConnection = null;
88
  private static Connection mConnection = null;
-
 
89
 
-
 
90
  /**database session handle
-
 
91
   * @attribute
-
 
92
   */
-
 
93
  private static final ReentrantLock mSession = new ReentrantLock();
88
 
94
 
89
  /**index to current ReleaseConfig item
95
  /**index to current ReleaseConfig item
90
   * @attribute
96
   * @attribute
91
   */
97
   */
92
  private int mReleaseConfigIndex = -1;
98
  private int mReleaseConfigIndex = -1;
Line 3542... Line 3548...
3542
  /**connect to oracle
3548
  /**connect to oracle
3543
   */
3549
   */
3544
  public void connect() throws SQLException, Exception
3550
  public void connect() throws SQLException, Exception
3545
  {
3551
  {
3546
    mLogger.debug("connect");
3552
    mLogger.debug("connect");
-
 
3553
    mSession.lock();
3547
    
3554
    
3548
    if ( !mUseDatabase )
3555
    if ( !mUseDatabase )
3549
    {
3556
    {
3550
      mLogger.info("connect !mUseDatabase");
3557
      mLogger.info("connect !mUseDatabase");
3551
    }
3558
    }
Line 3572... Line 3579...
3572
      // unless the failure is on the first attempt
3579
      // unless the failure is on the first attempt
3573
      boolean problemConnecting;
3580
      boolean problemConnecting;
3574
      
3581
      
3575
      do
3582
      do
3576
      {
3583
      {
3577
        mLogger.debug("connect getConnection check connection");
3584
        mLogger.warn("connect check connection");
3578
        problemConnecting = false;
3585
        problemConnecting = false;
3579
        
3586
        
3580
        try
3587
        try
3581
        {
3588
        {
3582
          if ( mConnection == null || mConnection.isClosed() )
3589
          if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
3583
          {
3590
          {
-
 
3591
            mLogger.warn("connect calling getConnection");
3584
            mConnection = DriverManager.getConnection(mConnectionString, mUsername, mPassword);
3592
            mConnection = DriverManager.getConnection(mConnectionString, mUsername, mPassword);
3585
          }
3593
          }
3586
        }
3594
        }
3587
        catch(SQLException e)
3595
        catch(SQLException e)
3588
        {
3596
        {
-
 
3597
          mLogger.warn("connect determined problem connecting");
3589
          problemConnecting = true;
3598
          problemConnecting = true;
3590
          try
3599
          try
3591
          {
3600
          {
3592
            // sleep 30 secs
3601
            // sleep 30 secs
3593
            mLogger.warn("connect getConnection failed. sleep 30secs");
3602
            mLogger.warn("connect getConnection failed. sleep 30secs");
Line 3628... Line 3637...
3628
      {
3637
      {
3629
        mLogger.error("disconnect caught Exception");
3638
        mLogger.error("disconnect caught Exception");
3630
        throw new Exception();
3639
        throw new Exception();
3631
      }
3640
      }
3632
    }*/
3641
    }*/
-
 
3642
    mSession.unlock();
3633
  }
3643
  }
3634
 
3644
 
3635
  /**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id of the first element
3645
  /**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id of the first element
3636
   */
3646
   */
3637
  public boolean getFirstReleaseConfig(MutableInt rcon_id)
3647
  public boolean getFirstReleaseConfig(MutableInt rcon_id)