Subversion Repositories DevTools

Rev

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

Rev 4280 Rev 4285
Line 1... Line 1...
1
package com.erggroup.buildtool.ripple;
1
package com.erggroup.buildtool.ripple;
2
 
2
 
3
import java.sql.CallableStatement;
3
import java.sql.CallableStatement;
4
import java.sql.Connection;
4
import java.sql.Connection;
5
 
-
 
6
import java.sql.DriverManager;
5
import java.sql.DriverManager;
7
 
-
 
8
import java.sql.PreparedStatement;
6
import java.sql.PreparedStatement;
9
import java.sql.ResultSet;
7
import java.sql.ResultSet;
10
import java.sql.SQLException;
8
import java.sql.SQLException;
11
 
-
 
12
import java.sql.Timestamp;
9
import java.sql.Timestamp;
13
 
-
 
14
import java.sql.Types;
10
import java.sql.Types;
15
 
-
 
16
import java.util.Calendar;
11
import java.util.Calendar;
17
import java.util.Date;
12
import java.util.Date;
18
import java.util.GregorianCalendar;
13
import java.util.GregorianCalendar;
19
import java.util.Iterator;
14
import java.util.Iterator;
20
import java.util.ListIterator;
15
import java.util.ListIterator;
Line 38... Line 33...
38
   * Value of GBE_BUILDTOOL_DEBUG is expected to be an email if greater than
33
   * Value of GBE_BUILDTOOL_DEBUG is expected to be an email if greater than
39
   * one character.
34
   * one character.
40
   *
35
   *
41
   * When set to false will:
36
   * When set to false will:
42
   *    Prevents use of Oracle Mutex and potential lockout during debug sessions.
37
   *    Prevents use of Oracle Mutex and potential lockout during debug sessions.
43
   *    Prevent the initiaition of an indefinite pause.
38
   *    Prevent the initiation of an indefinite pause.
44
   * @attribute
39
   * @attribute
45
   */
40
   */
46
  public static boolean mUseMutex = true;
41
  public static boolean mUseMutex = true;
47
 
42
 
48
  /**Unit test hook
43
  /**Unit test hook
Line 111... Line 106...
111
   * note this handle is only ever set to mNonPlanningConnection or mPlanningConnection
106
   * note this handle is only ever set to mNonPlanningConnection or mPlanningConnection
112
   * @attribute
107
   * @attribute
113
   */
108
   */
114
  private Connection mConnection = null;
109
  private Connection mConnection = null;
115
 
110
 
116
  /**thread synchronisation governing non planning database connection usage
111
  /**thread synchronization governing non planning database connection usage
117
   * this lock is used by all build threads
112
   * this lock is used by all build threads
118
   * @attribute
113
   * @attribute
119
   */
114
   */
120
  private static final ReentrantLock mSession = new ReentrantLock();
115
  private static final ReentrantLock mSession = new ReentrantLock();
121
 
116
 
122
  /**thread synchronisation governing database connection usage
117
  /**thread synchronization governing database connection usage
123
   * this lock is used by master threads with a high priority planning requirement
118
   * this lock is used by master threads with a high priority planning requirement
124
   * and at most one thread with a low priority planning requirement
119
   * and at most one thread with a low priority planning requirement
125
   * @attribute
120
   * @attribute
126
   */
121
   */
127
  private static final ReentrantLock mPlanningSession = new ReentrantLock();
122
  private static final ReentrantLock mPlanningSession = new ReentrantLock();
128
 
123
 
129
  /**thread synchronisation governing database connection request queueing
124
  /**thread synchronization governing database connection request queueing
130
   * this lock is used by master threads with a low priority planning requirement
125
   * this lock is used by master threads with a low priority planning requirement
131
   * use the fairness parameter to grant access to the longest waiting thread
126
   * use the fairness parameter to grant access to the longest waiting thread
132
   * @attribute
127
   * @attribute
133
   */
128
   */
134
  private static final ReentrantLock mLowPriorityQueue = new ReentrantLock(true);
129
  private static final ReentrantLock mLowPriorityQueue = new ReentrantLock(true);
135
 
130
 
136
  /**index to current ReleaseConfig item
-
 
137
   * @attribute
-
 
138
   */
-
 
139
  private int mReleaseConfigIndex = -1;
-
 
140
 
-
 
141
  /**index to current RunLevel item
-
 
142
   * @attribute
-
 
143
   */
-
 
144
  private int mRunLevelIndex = -1;
-
 
145
 
-
 
146
  /**collection of ReleaseConfig objects
131
   /**collection of ReleaseConfig objects
147
   * @attribute
132
   * @attribute
148
   */
133
   */
149
  public Vector<ReleaseConfig> mReleaseConfigCollection = new Vector<ReleaseConfig>();
134
  public Vector<ReleaseConfig> mReleaseConfigCollection = new Vector<ReleaseConfig>();
150
 
135
 
151
  /**database connection string
136
  /**database connection string
Line 164... Line 149...
164
  private static String mPassword = new String();
149
  private static String mPassword = new String();
165
 
150
 
166
  /**collection of RunLevel objects
151
  /**collection of RunLevel objects
167
   * @attribute
152
   * @attribute
168
   */
153
   */
169
  private Vector<RunLevel> mRunLevelCollection = new Vector<RunLevel>();
154
  public Vector<RunLevelData> mRunLevelCollection = new Vector<RunLevelData>();
170
  
155
  
171
  /**set in claimVersion, cleared in discardVersion
156
  /**set in claimVersion, cleared in discardVersion
172
   * @attribute
157
   * @attribute
173
   */
158
   */
174
  private String mPlannedPkgId = null;
159
  private String mPlannedPkgId = null;
175
  
160
  
176
  /**prevents inadvertantly attempting a commit which releases record locks in between claimMutex and releaseMutex
161
  /**prevents inadvertently attempting a commit which releases record locks in between claimMutex and releaseMutex
177
   * @attribute
162
   * @attribute
178
   */
163
   */
179
  private boolean mDoNotCommit = false;
164
  private boolean mDoNotCommit = false;
180
  
165
  
181
  /**set in claimVersion, cleared in discardVersion
166
  /**set in claimVersion, cleared in discardVersion
Line 3224... Line 3209...
3224
       
3209
       
3225
      }
3210
      }
3226
    }
3211
    }
3227
  }
3212
  }
3228
 
3213
 
3229
  /**returns the Package with the matching mID or NULL_PACKAGE if no package has the mID
-
 
3230
   */
-
 
3231
  private Package findPackage(int id, Vector<Package> packageCollection)
-
 
3232
  {
-
 
3233
    mLogger.debug("findPackage 1 id " + id);
-
 
3234
    Package retVal = NULL_PACKAGE;
-
 
3235
 
-
 
3236
    for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
-
 
3237
    {
-
 
3238
      Package p = it.next();
-
 
3239
      
-
 
3240
      if ( p.mId == id )
-
 
3241
      {
-
 
3242
        retVal = p;
-
 
3243
        break;
-
 
3244
      }
-
 
3245
    }
-
 
3246
    
-
 
3247
    mLogger.debug("findPackage 1 returned " + retVal.mName);
-
 
3248
    return retVal;
-
 
3249
  }
-
 
3250
 
-
 
3251
  /**called only in escrow mode to add build info to the Package
3214
  /**called only in escrow mode to add build info to the Package
3252
   * select bm.bm_name, bsa.bsa_name
3215
   * select bm.bm_name, bsa.bsa_name
3253
   * from release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa
3216
   * from release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa
3254
   * where pv.pv_id = <p.pv_id> and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id
3217
   * where pv.pv_id = <p.pv_id> and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id
3255
   * order by pv.pv_id;
3218
   * order by pv.pv_id;
Line 3383... Line 3346...
3383
        }
3346
        }
3384
      }
3347
      }
3385
    }
3348
    }
3386
  }
3349
  }
3387
 
3350
 
-
 
3351
  /**returns the Package with the matching mID or NULL_PACKAGE if no package has the mID
-
 
3352
   */
-
 
3353
  private Package findPackage(int id, Vector<Package> packageCollection)
-
 
3354
  {
-
 
3355
    mLogger.debug("findPackage 1 id " + id);
-
 
3356
    Package retVal = NULL_PACKAGE;
-
 
3357
 
-
 
3358
    for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
-
 
3359
    {
-
 
3360
      Package p = it.next();
-
 
3361
      
-
 
3362
      if ( p.mId == id )
-
 
3363
      {
-
 
3364
        retVal = p;
-
 
3365
        break;
-
 
3366
      }
-
 
3367
    }
-
 
3368
    
-
 
3369
    mLogger.debug("findPackage 1 returned " + retVal.mName);
-
 
3370
    return retVal;
-
 
3371
  }
-
 
3372
 
3388
  /**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mAlias
3373
/**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mAlias
3389
   */
3374
   */
3390
  private Package findPackage(String alias, Vector<Package> packageCollection)
3375
  private Package findPackage(String alias, Vector<Package> packageCollection)
3391
  {
3376
  {
3392
    mLogger.debug("findPackage 2 alias " + alias);
3377
    mLogger.debug("findPackage 2 alias " + alias);
3393
    Package retVal = NULL_PACKAGE;
3378
    Package retVal = NULL_PACKAGE;
Line 4369... Line 4354...
4369
        }
4354
        }
4370
      }
4355
      }
4371
    }
4356
    }
4372
  }
4357
  }
4373
 
4358
 
4374
  /**Representation of a row in the RELEASE_CONFIG table
-
 
4375
   */
-
 
4376
 
-
 
4377
  /**Representation of a row in the RUN_LEVEL table
-
 
4378
   */
-
 
4379
  private class RunLevel
-
 
4380
  {
4359
   
4381
    /**rcon_id column value
-
 
4382
     * @attribute
-
 
4383
     */
-
 
4384
    private int mRcon_id;
-
 
4385
 
-
 
4386
    /**current_build_files column value
-
 
4387
     * @attribute
-
 
4388
     */
-
 
4389
    private String mCurrent_build_file;
-
 
4390
 
-
 
4391
    /**current_run_level column value
-
 
4392
     * @attribute
-
 
4393
     */
-
 
4394
    private int mCurrent_run_level;
-
 
4395
 
-
 
4396
    /**pause column value
-
 
4397
     * @attribute
-
 
4398
     */
-
 
4399
    private boolean mPause;
-
 
4400
 
-
 
4401
    /**constructor
-
 
4402
     */
-
 
4403
    RunLevel(int rcon_id, String current_build_file, int current_run_level, boolean pause)
-
 
4404
    {
-
 
4405
      mLogger.debug("RunLevel");
-
 
4406
      mRcon_id = rcon_id;
-
 
4407
      mCurrent_build_file = current_build_file;
-
 
4408
      mCurrent_run_level = current_run_level;
-
 
4409
      mPause = pause;
-
 
4410
    }
-
 
4411
 
-
 
4412
    /**accessor method
-
 
4413
     */
-
 
4414
    int get_rcon_id()
-
 
4415
    {
-
 
4416
      mLogger.debug("get_rcon_id");
-
 
4417
      mLogger.info("get_rcon_id returned " + mRcon_id);
-
 
4418
      return mRcon_id;
-
 
4419
    }
-
 
4420
 
-
 
4421
    /**accessor method
-
 
4422
     */
-
 
4423
    String get_current_build_file()
-
 
4424
    {
-
 
4425
      mLogger.debug("get_current_build_file");
-
 
4426
      mLogger.info("get_current_build_file returned " + mCurrent_build_file);
-
 
4427
      return mCurrent_build_file;
-
 
4428
    }
-
 
4429
 
-
 
4430
    /**accessor method
-
 
4431
     */
-
 
4432
    int get_current_run_level()
-
 
4433
    {
-
 
4434
      mLogger.debug("get_current_run_level");
-
 
4435
      mLogger.info("get_current_run_level returned " + mCurrent_run_level);
-
 
4436
      return mCurrent_run_level;
-
 
4437
    }
-
 
4438
 
-
 
4439
    /**accessor method
-
 
4440
     */
-
 
4441
    boolean get_pause()
-
 
4442
    {
-
 
4443
      mLogger.debug("get_pause");
-
 
4444
      mLogger.debug("get_pause returned " + mPause);      
-
 
4445
      return mPause;
-
 
4446
    }
-
 
4447
 
-
 
4448
  }
4360
  
4449
 
4361
 
4450
  /**constructor
4362
  /**constructor
4451
   */
4363
   */
4452
  public ReleaseManager(final String connectionString, final String username, 
4364
  public ReleaseManager(final String connectionString, final String username, 
4453
                        final String password)
4365
                        final String password)
Line 4637... Line 4549...
4637
      session.unlock();
4549
      session.unlock();
4638
      mLogger.warn("disconnected called unlock");
4550
      mLogger.warn("disconnected called unlock");
4639
    }
4551
    }
4640
  }
4552
  }
4641
 
4553
 
4642
  /**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id of the first element
-
 
4643
   */
-
 
4644
  public boolean getFirstReleaseConfig(MutableInt rcon_id)
-
 
4645
  {
-
 
4646
    mLogger.debug("getFirstReleaseConfig 1");
-
 
4647
    boolean retVal = true;
-
 
4648
    
-
 
4649
    try
-
 
4650
    {
-
 
4651
      mReleaseConfigIndex = 0;
-
 
4652
      ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
-
 
4653
      rcon_id.value = rc.get_rcon_id();
-
 
4654
    }
-
 
4655
    catch( ArrayIndexOutOfBoundsException e )
-
 
4656
    {
-
 
4657
      retVal = false;
-
 
4658
    }
-
 
4659
    
-
 
4660
    mLogger.info("getFirstReleaseConfig 1 returning " + retVal);
-
 
4661
    return retVal;
-
 
4662
  }
-
 
4663
 
-
 
4664
  /**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id, rtag_id, daemon_mode and gbebuildfilter of the first element
-
 
4665
   */
-
 
4666
  public boolean getFirstReleaseConfig(MutableInt rtag_id, 
-
 
4667
                                       MutableInt rcon_id, 
-
 
4668
                                       MutableChar daemon_mode)
-
 
4669
  {
-
 
4670
    mLogger.debug("getFirstReleaseConfig 2");
-
 
4671
    boolean retVal = true;
-
 
4672
    
-
 
4673
    try
-
 
4674
    {
-
 
4675
      mReleaseConfigIndex = 0;
-
 
4676
      ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
-
 
4677
      rtag_id.value = rc.get_rtag_id();
-
 
4678
      rcon_id.value = rc.get_rcon_id();
-
 
4679
      daemon_mode.value = rc.get_daemon_mode();
-
 
4680
    }
-
 
4681
    catch( ArrayIndexOutOfBoundsException e )
-
 
4682
    {
-
 
4683
      retVal = false;
-
 
4684
    }
-
 
4685
    
-
 
4686
    mLogger.info("getFirstReleaseConfig 2 returning " + retVal);
-
 
4687
    return retVal;
-
 
4688
  }
-
 
4689
 
-
 
4690
  /**returns true if the mReleaseConfigCollection contains a next element and returns the rcon_id of the next element
-
 
4691
   */
-
 
4692
  public boolean getNextReleaseConfig(MutableInt rcon_id)
-
 
4693
  {
-
 
4694
    mLogger.debug("getNextReleaseConfig 1");
-
 
4695
    boolean retVal = true;
-
 
4696
    
-
 
4697
    try
-
 
4698
    {
-
 
4699
      mReleaseConfigIndex++;
-
 
4700
      ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
-
 
4701
      rcon_id.value = rc.get_rcon_id();
-
 
4702
    }
-
 
4703
    catch( ArrayIndexOutOfBoundsException e )
-
 
4704
    {
-
 
4705
      retVal = false;
-
 
4706
    }
-
 
4707
    
-
 
4708
    mLogger.info("getNextReleaseConfig 1 returning " + retVal);
-
 
4709
    return retVal;
-
 
4710
  }
-
 
4711
 
-
 
4712
  /**returns true if the mReleaseConfigCollection contains a next element and returns the rcon_id, rtag_id, daemon_mode and gbebuildfilter of the next element
-
 
4713
   */
-
 
4714
  public boolean getNextReleaseConfig(MutableInt rtag_id, 
-
 
4715
                                      MutableInt rcon_id, 
-
 
4716
                                      MutableChar daemon_mode)
-
 
4717
  {
-
 
4718
    mLogger.debug("getNextReleaseConfig 2");
-
 
4719
    boolean retVal = true;
-
 
4720
    
-
 
4721
    try
-
 
4722
    {
-
 
4723
      mReleaseConfigIndex++;
-
 
4724
      ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
-
 
4725
      rtag_id.value = rc.get_rtag_id();
-
 
4726
      rcon_id.value = rc.get_rcon_id();
-
 
4727
      daemon_mode.value = rc.get_daemon_mode();
-
 
4728
    }
-
 
4729
    catch( ArrayIndexOutOfBoundsException e )
-
 
4730
    {
-
 
4731
      retVal = false;
-
 
4732
    }
-
 
4733
    
-
 
4734
    mLogger.info("getNextReleaseConfig 2 returning " + retVal);
-
 
4735
    return retVal;
-
 
4736
  }
-
 
4737
 
-
 
4738
  /**returns true if the mRunLevelCollection is not empty and returns the rcon_id and current_run_level of the first element
-
 
4739
   */
-
 
4740
  public boolean getFirstRunLevel(MutableInt rcon_id, 
-
 
4741
                                  MutableInt current_run_level)
-
 
4742
  {
-
 
4743
    mLogger.debug("getFirstRunLevel");
-
 
4744
    boolean retVal = true;
-
 
4745
    
-
 
4746
    try
-
 
4747
    {
-
 
4748
      mRunLevelIndex = 0;
-
 
4749
      RunLevel rl = mRunLevelCollection.get( mRunLevelIndex );
-
 
4750
      rcon_id.value = rl.get_rcon_id();
-
 
4751
      current_run_level.value = rl.get_current_run_level();
-
 
4752
    }
-
 
4753
    catch( ArrayIndexOutOfBoundsException e )
-
 
4754
    {
-
 
4755
      retVal = false;
-
 
4756
    }
-
 
4757
    
-
 
4758
    mLogger.info("getFirstRunLevel returning " + retVal);
-
 
4759
    return retVal;
-
 
4760
  }
-
 
4761
 
-
 
4762
  /**returns true if the mRunLevelCollection contains a next element and returns the rcon_id and current_run_level of the next element
-
 
4763
   */
-
 
4764
  public boolean getNextRunLevel(MutableInt rcon_id, 
-
 
4765
                                 MutableInt current_run_level)
-
 
4766
  {
-
 
4767
    mLogger.debug("getNextRunLevel");
-
 
4768
    boolean retVal = true;
-
 
4769
    
-
 
4770
    try
-
 
4771
    {
-
 
4772
      mRunLevelIndex++;
-
 
4773
      RunLevel rl = mRunLevelCollection.get( mRunLevelIndex );
-
 
4774
      rcon_id.value = rl.get_rcon_id();
-
 
4775
      current_run_level.value = rl.get_current_run_level();
-
 
4776
    }
-
 
4777
    catch( ArrayIndexOutOfBoundsException e )
-
 
4778
    {
-
 
4779
      retVal = false;
-
 
4780
    }
-
 
4781
    
-
 
4782
    mLogger.info("getNextRunLevel returning " + retVal);
-
 
4783
    return retVal;
-
 
4784
  }
-
 
4785
 
-
 
4786
  /**queries the RUN_LEVEL table using the rcon_id primary key
4554
  /**queries the RUN_LEVEL table using the rcon_id primary key
4787
   * returns false if the query returns a result set containing one row with a non NULL pause column
4555
   * returns false if the query returns a result set containing one row with a non NULL pause column
4788
   * returns false if the rcon_id is no longer configured
4556
   * returns false if the rcon_id is no longer configured
4789
   * (indicating intent to pause the thread)
4557
   * (indicating intent to pause the thread)
4790
   * refer to sequence diagram allowed to proceed
4558
   * refer to sequence diagram allowed to proceed
Line 5240... Line 5008...
5240
   * returns the current_build_files
5008
   * returns the current_build_files
5241
   * implements the sequence diagram consume build files 
5009
   * implements the sequence diagram consume build files 
5242
   *  
5010
   *  
5243
   * Used by the Slave Daemon 
5011
   * Used by the Slave Daemon 
5244
   */
5012
   */
5245
  public void queryRunLevel(int rcon_id, MutableString currentBuildFiles) throws SQLException, Exception
5013
  public void queryBuildFile(int rcon_id, MutableString currentBuildFiles) throws SQLException, Exception
5246
  {
5014
  {
5247
    mLogger.debug("queryRunLevel 1 rcon_id " + rcon_id);
5015
    mLogger.debug("queryRunLevel 1 rcon_id " + rcon_id);
5248
    if ( !mUseDatabase )
5016
    if ( !mUseDatabase )
5249
    {
5017
    {
5250
      mLogger.info("queryRunLevel 1 !mUseDatabase");
5018
      mLogger.info("queryRunLevel 1 !mUseDatabase");
Line 5319... Line 5087...
5319
      mLogger.info("queryRunLevel 2 unit test coordinate slave threads");
5087
      mLogger.info("queryRunLevel 2 unit test coordinate slave threads");
5320
      
5088
      
5321
      if ( mRunLevelCollection.size() == 0)
5089
      if ( mRunLevelCollection.size() == 0)
5322
      {
5090
      {
5323
        // first time not all slave threads are waiting
5091
        // first time not all slave threads are waiting
5324
        RunLevel runLevel = new RunLevel(1, "", DB_WAITING, false);
5092
        RunLevelData runLevel = new RunLevelData(1, DB_WAITING);
5325
        mRunLevelCollection.add(runLevel);
5093
        mRunLevelCollection.add(runLevel);
5326
        runLevel = new RunLevel(2, "", DB_IDLE, false);
5094
        runLevel = new RunLevelData(2, DB_IDLE);
5327
        mRunLevelCollection.add(runLevel);
5095
        mRunLevelCollection.add(runLevel);
5328
      }
5096
      }
5329
      else
5097
      else
5330
      {
5098
      {
5331
        // subsequent times all slave threads are waiting
5099
        // subsequent times all slave threads are waiting
5332
        mRunLevelCollection.removeAllElements();
5100
        mRunLevelCollection.removeAllElements();
5333
        RunLevel runLevel = new RunLevel(1, "", DB_WAITING, false);
5101
        RunLevelData runLevel = new RunLevelData(1, DB_WAITING);
5334
        mRunLevelCollection.add(runLevel);
5102
        mRunLevelCollection.add(runLevel);
5335
        runLevel = new RunLevel(2, "", DB_WAITING, false);
5103
        runLevel = new RunLevelData(2, DB_WAITING);
5336
        mRunLevelCollection.add(runLevel);
5104
        mRunLevelCollection.add(runLevel);
5337
      }
5105
      }
5338
    }
5106
    }
5339
    
5107
    
5340
    if ( mUseDatabase )
5108
    if ( mUseDatabase )
Line 5346... Line 5114...
5346
        connect();
5114
        connect();
5347
        CallableStatement stmt = mConnection.prepareCall(
5115
        CallableStatement stmt = mConnection.prepareCall(
5348
            "select rl.rcon_id, rl.current_run_level from release_manager.release_config rc, release_manager.run_level rl " +
5116
            "select rl.rcon_id, rl.current_run_level from release_manager.release_config rc, release_manager.run_level rl " +
5349
            "where rc.rtag_id=" +rtag_id + " and rl.rcon_id=rc.rcon_id");
5117
            "where rc.rtag_id=" +rtag_id + " and rl.rcon_id=rc.rcon_id");
5350
        ResultSet rset = stmt.executeQuery();
5118
        ResultSet rset = stmt.executeQuery();
5351
        int rsetSize = 0;
-
 
5352
        int rcon_id = 0;
5119
        int rcon_id = 0;
5353
        int current_run_level = 0;
5120
        int current_run_level = 0;
5354
        
5121
        
5355
        while( rset.next() )
5122
        while( rset.next() )
5356
        {
5123
        {
5357
          rsetSize++;
-
 
5358
          rcon_id = rset.getInt("rcon_id");
5124
          rcon_id = rset.getInt("rcon_id");
5359
          
5125
          
5360
          if ( rset.wasNull() )
5126
          if ( rset.wasNull() )
5361
          {
5127
          {
5362
            mLogger.fatal("queryRunLevel 2 null rcon_id");
5128
            mLogger.fatal("queryRunLevel 2 null rcon_id");
Line 5371... Line 5137...
5371
            // slave may never have started to insert run level
5137
            // slave may never have started to insert run level
5372
            // use idle
5138
            // use idle
5373
            current_run_level = DB_IDLE;
5139
            current_run_level = DB_IDLE;
5374
          }
5140
          }
5375
          
5141
          
5376
          RunLevel runLevel = new RunLevel(rcon_id, "", current_run_level, false);
5142
          RunLevelData runLevel = new RunLevelData(rcon_id, current_run_level);
5377
          mRunLevelCollection.add(runLevel);
5143
          mRunLevelCollection.add(runLevel);
5378
        }
5144
        }
5379
 
5145
 
5380
        rset.close();
5146
        rset.close();
5381
        stmt.close();
5147
        stmt.close();
Line 5415... Line 5181...
5415
    if ( !mUseDatabase )
5181
    if ( !mUseDatabase )
5416
    {
5182
    {
5417
      mLogger.info("querySingleRunLevel !mUseDatabase");
5183
      mLogger.info("querySingleRunLevel !mUseDatabase");
5418
      
5184
      
5419
      mRunLevelCollection.removeAllElements();
5185
      mRunLevelCollection.removeAllElements();
5420
      RunLevel runLevel = new RunLevel(rcon_id, "", DB_ACTIVE, false);
5186
      RunLevelData runLevel = new RunLevelData(rcon_id, DB_ACTIVE);
5421
      mRunLevelCollection.add(runLevel);
5187
      mRunLevelCollection.add(runLevel);
5422
    }
5188
    }
5423
    else
5189
    else
5424
    {
5190
    {
5425
      mRunLevelCollection.removeAllElements();
5191
      mRunLevelCollection.removeAllElements();
Line 5447... Line 5213...
5447
              mLogger.fatal("querySingleRunLevel null current_run_level");
5213
              mLogger.fatal("querySingleRunLevel null current_run_level");
5448
              // show stopper
5214
              // show stopper
5449
              throw new Exception("querySingleRunLevel null current_run_level");
5215
              throw new Exception("querySingleRunLevel null current_run_level");
5450
            }
5216
            }
5451
            
5217
            
5452
            RunLevel runLevel = new RunLevel(rcon_id, "", current_run_level, false);
5218
            RunLevelData runLevel = new RunLevelData(rcon_id, current_run_level);
5453
            mRunLevelCollection.add(runLevel);
5219
            mRunLevelCollection.add(runLevel);
5454
          }
5220
          }
5455
  
5221
  
5456
          rset.close();
5222
          rset.close();
5457
          stmt.close();
5223
          stmt.close();