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.daemon;
1
package com.erggroup.buildtool.daemon;
2
 
2
 
3
import com.erggroup.buildtool.daemon.BuildThread;
3
import com.erggroup.buildtool.daemon.BuildThread;
4
import com.erggroup.buildtool.ripple.MutableInt;
-
 
5
import com.erggroup.buildtool.ripple.MutableString;
4
import com.erggroup.buildtool.ripple.MutableString;
6
import com.erggroup.buildtool.ripple.Package;
5
import com.erggroup.buildtool.ripple.Package;
-
 
6
import com.erggroup.buildtool.ripple.ReleaseConfig;
7
import com.erggroup.buildtool.ripple.ReleaseManager;
7
import com.erggroup.buildtool.ripple.ReleaseManager;
8
import com.erggroup.buildtool.ripple.RippleEngine;
8
import com.erggroup.buildtool.ripple.RippleEngine;
-
 
9
import com.erggroup.buildtool.ripple.RunLevelData;
9
import com.erggroup.buildtool.smtp.Smtpsend;
10
import com.erggroup.buildtool.smtp.Smtpsend;
10
 
11
 
11
import java.io.BufferedReader;
12
import java.io.BufferedReader;
12
import java.io.DataInputStream;
13
import java.io.DataInputStream;
13
import java.io.File;
14
import java.io.File;
14
import java.io.FileInputStream;
15
import java.io.FileInputStream;
15
import java.io.InputStreamReader;
16
import java.io.InputStreamReader;
16
import java.sql.SQLException;
17
import java.sql.SQLException;
-
 
18
import java.util.Iterator;
17
import java.lang.System;
19
import java.lang.System;
18
 
20
 
19
import org.apache.log4j.Logger;
21
import org.apache.log4j.Logger;
20
 
22
 
21
/**Master Thread sub component
23
/**Master Thread sub component
Line 52... Line 54...
52
   */
54
   */
53
  public void run()
55
  public void run()
54
  {
56
  {
55
    Integer id = new Integer(mRtagId);
57
    Integer id = new Integer(mRtagId);
56
    setName(id.toString());
58
    setName(id.toString());
57
    mLogger.warn("run");
59
    mLogger.warn("Master Thread run");
58
    boolean exit = false;
60
    boolean exit = false;
59
    RippleEngine rippleEngine = new RippleEngine(mReleaseManager, mRtagId, true);
61
    RippleEngine rippleEngine = new RippleEngine(mReleaseManager, mRtagId, true);
60
    MutableInt rconId = new MutableInt();
-
 
61
    MutableInt current_run_level = new MutableInt();
-
 
62
    MutableString addendum = new MutableString();
62
    MutableString addendum = new MutableString();
63
 
63
 
64
    while(!exit)
64
    while(!exit)
65
    {
65
    {
66
      try
66
      try
Line 114... Line 114...
114
              while ( !allSlaveThreadsWaiting )
114
              while ( !allSlaveThreadsWaiting )
115
              {
115
              {
116
                mLogger.fatal("run calling mReleaseManager.queryRunLevel");
116
                mLogger.fatal("run calling mReleaseManager.queryRunLevel");
117
                mReleaseManager.queryRunLevel(mRtagId);
117
                mReleaseManager.queryRunLevel(mRtagId);
118
                
118
                
119
                // anything but WAITING or PAUSED
-
 
120
                current_run_level.value = ReleaseManager.DB_IDLE;
-
 
121
                mLogger.fatal("run calling mReleaseManager.getFirstRunLevel");
-
 
122
                boolean moreRunLevelsConfigured = mReleaseManager.getFirstRunLevel(rconId, current_run_level);
-
 
123
                  
-
 
124
                // attempt to exit loop
119
                //	Process all run entries
125
                allSlaveThreadsWaiting = true;
120
                allSlaveThreadsWaiting = true;
126
            
-
 
127
                do
121
                for (Iterator<RunLevelData> it = mReleaseManager.mRunLevelCollection.iterator(); it.hasNext(); )
128
                {
122
                {
129
                  if (moreRunLevelsConfigured)
123
                	RunLevelData rl = it.next();
-
 
124
                	int runLevel = rl.get_current_run_level();
130
                  {
125
                	
131
                    // DEVI 53065 Slave indication that they are done with a package includes
126
                	// DEVI 53065 Slave indication that they are done with a package includes
132
                    // having a paused run level
127
                    // having a paused run level
133
                    if ((current_run_level.value != ReleaseManager.DB_WAITING) &&
128
                    if ((runLevel != ReleaseManager.DB_WAITING) &&
134
                        (current_run_level.value != ReleaseManager.DB_PAUSED))
129
                        (runLevel != ReleaseManager.DB_PAUSED))
135
                    {
130
                    {
136
                      if ( logWarning )
131
                      if ( logWarning )
137
                      {
132
                      {
138
                        mLogger.warn("run waiting for rcon id " + rconId.value);
133
                        mLogger.warn("run waiting for rcon id " + rl.get_rcon_id());
139
                        logWarning = false;
134
                        logWarning = false;
140
                      }
135
                      }
141
                      else
136
                      else
142
                      {
137
                      {
143
                        mLogger.info("run waiting for rcon id " + rconId.value);                      
138
                        mLogger.info("run waiting for rcon id " +  rl.get_rcon_id());                      
144
                      }
139
                      }
145
                      allSlaveThreadsWaiting = false;
140
                      allSlaveThreadsWaiting = false;
-
 
141
                      break;
146
                    }
142
                    }
147
                    else
-
 
148
                    {
-
 
149
                      mLogger.fatal("run calling mReleaseManager.getNextRunLevel");
-
 
150
                      moreRunLevelsConfigured = mReleaseManager.getNextRunLevel(rconId, current_run_level);
-
 
151
                    }
-
 
152
                  }
143
                	
153
                }
144
                }
154
                while (moreRunLevelsConfigured && allSlaveThreadsWaiting);
-
 
-
 
145
 
155
          
146
                          
156
                if ( !allSlaveThreadsWaiting )
147
                if ( !allSlaveThreadsWaiting )
157
                {
148
                {
158
                  // to do, sleep for periodicMs
149
                  // to do, sleep for periodicMs
159
                  if ( mUnitTest.compareTo("unit test coordinate slave threads") == 0 )
150
                  if ( mUnitTest.compareTo("unit test coordinate slave threads") == 0 )
160
                  {
151
                  {
Line 475... Line 466...
475
          //---------------------------------------------------------------
466
          //---------------------------------------------------------------
476
          //    Notify all slaves that there is work to be done
467
          //    Notify all slaves that there is work to be done
477
          //        Change the run level for all threads in associated with the baseline
468
          //        Change the run level for all threads in associated with the baseline
478
          //
469
          //
479
          mLogger.warn("run change the run level for all threads in associated with the baseline");
470
          mLogger.warn("run change the run level for all threads in associated with the baseline");
480
          rconId.value = -1;
471
          
481
          boolean moreBuildThreadsConfigured = mReleaseManager.getFirstReleaseConfig(rconId);
-
 
482
          mRunLevel = RunLevel.ACTIVE;
472
          mRunLevel = RunLevel.ACTIVE;
483
            
473
          for (Iterator<ReleaseConfig> it = mReleaseManager.mReleaseConfigCollection.iterator(); it.hasNext(); )
484
          do
-
 
485
          {
474
          {
486
            if (moreBuildThreadsConfigured)
475
            ReleaseConfig rc = it.next();
487
            {
476
            
488
                mLogger.warn("run changing run level to ACTIVE for rcon_id " + rconId.value);
477
            mLogger.warn("run changing run level to ACTIVE for rcon_id " + rc.get_rcon_id() );
489
                mLogger.fatal("run calling mRunLevel.persist to set ACTIVE");                      
478
            mLogger.fatal("run calling mRunLevel.persist to set ACTIVE");
490
                mRunLevel.persist(mReleaseManager, rconId.value);
479
            mRunLevel.persist(mReleaseManager, rc.get_rcon_id());
491
                moreBuildThreadsConfigured = mReleaseManager.getNextReleaseConfig(rconId);
-
 
492
            }
-
 
493
          }
480
          }
494
          while (moreBuildThreadsConfigured);
-
 
495
          
481
                    
496
          if ( mUnitTest.compareTo("unit test generate build files") == 0 )
482
          if ( mUnitTest.compareTo("unit test generate build files") == 0 )
497
          {
483
          {
498
            throw new ExitException();
484
            throw new ExitException();
499
          }
485
          }
500
        }
486
        }