Subversion Repositories DevTools

Rev

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

Rev 816 Rev 818
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;
4
import com.erggroup.buildtool.ripple.MutableString;
5
import com.erggroup.buildtool.ripple.MutableString;
-
 
6
import com.erggroup.buildtool.ripple.ReleaseManager;
-
 
7
 
5
import java.sql.SQLException;
8
import java.sql.SQLException;
6
import org.apache.log4j.Logger;
9
import org.apache.log4j.Logger;
7
 
10
 
8
/**Slave Thread sub component
11
/**Slave Thread sub component
9
 */
12
 */
Line 18... Line 21...
18
 
21
 
19
  /**constructor
22
  /**constructor
20
   */
23
   */
21
  public SlaveThread(int rtag_id, int rcon_id, String gbebuildfilter)
24
  public SlaveThread(int rtag_id, int rcon_id, String gbebuildfilter)
22
  {
25
  {
23
    mLogger.debug("SlaveThread " + rtag_id);
26
    mLogger.warn("SlaveThread rtag_id " + rtag_id + " rcon_id " + rcon_id);
24
    mRtagId = rtag_id;
27
    mRtagId = rtag_id;
25
    mRconId = rcon_id;
28
    mRconId = rcon_id;
26
    mGbebuildfilter = gbebuildfilter;
29
    mGbebuildfilter = gbebuildfilter;
27
  }
30
  }
28
 
31
 
Line 63... Line 66...
63
        // consume build files
66
        // consume build files
64
        mLogger.warn("run consume build files");
67
        mLogger.warn("run consume build files");
65
        buildFileContent.value = "";
68
        buildFileContent.value = "";
66
        boolean logWarning = true;
69
        boolean logWarning = true;
67
        
70
        
-
 
71
        // additional handshake
-
 
72
        // Master waits for Slave to be in state waiting
-
 
73
        // wait for the Master to signal we are active
-
 
74
        MutableInt rconId = new MutableInt();
-
 
75
        MutableInt current_run_level = new MutableInt();
-
 
76
        
68
        do
77
        do
69
        {
78
        {
-
 
79
          mReleaseManager.querySingleRunLevel(mRconId);
70
          mReleaseManager.queryRunLevel(mRconId, buildFileContent);
80
          mReleaseManager.getFirstRunLevel(rconId, current_run_level);
71
          
81
          
72
          if ( buildFileContent.value.compareTo("") == 0)
82
          if (current_run_level.value != ReleaseManager.DB_ACTIVE)
73
          {
83
          {
74
            try
84
            try
75
            {
85
            {
76
              // insurance at little cost
-
 
77
              mRunLevel = RunLevel.WAITING;
-
 
78
              
-
 
79
              if ( logWarning )
-
 
80
              {
-
 
81
                mLogger.warn("run changing run level to WAITING for rcon_id " + mRconId);
-
 
82
              }
-
 
83
              else
-
 
84
              {
-
 
85
                mLogger.warn("run changing run level to WAITING for rcon_id " + mRconId);
-
 
86
              }
-
 
87
              mRunLevel.persist(mReleaseManager, mRconId);
-
 
88
 
-
 
89
              if ( logWarning )
86
              if ( logWarning )
90
              {
87
              {
91
                mLogger.warn("run sleep 3 secs waiting for build files");
88
                mLogger.warn("run sleep 3 secs waiting for Master to set Slave run level ACTIVE");
92
                logWarning = false;
89
                logWarning = false;
93
              }
90
              }
94
              else
91
              else
95
              {
92
              {
96
                mLogger.info("run sleep 3 secs waiting for build files");
93
                mLogger.info("run sleep 3 secs waiting for Master to set Slave run level ACTIVE");
97
              }
94
              }
98
              // to do, sleep for periodicMs
95
              // to do, sleep for periodicMs
99
              Thread.sleep(3000);
96
              Thread.sleep(3000);
100
              mLogger.info("run sleep returned");
97
              mLogger.info("run sleep returned");
101
            }
98
            }
102
            catch (InterruptedException e)
99
            catch (InterruptedException e)
103
            {
100
            {
104
              mLogger.warn("run caught InterruptedException");
101
              mLogger.warn("run caught InterruptedException");
105
            }
102
            }
106
          }
103
          }
-
 
104
        } while (current_run_level.value != ReleaseManager.DB_ACTIVE);
-
 
105
 
-
 
106
        mReleaseManager.queryRunLevel(mRconId, buildFileContent);
-
 
107
        
107
        } while ( buildFileContent.value.compareTo("") == 0);
108
        if ( buildFileContent.value.compareTo("") == 0)
-
 
109
        {
-
 
110
          throw new Exception();
-
 
111
        }
108
        
112
        
109
        mLogger.info("run consumed build files");
113
        mLogger.info("run consumed build files");
110
 
114
 
111
        if ( mGbebuildfilter.compareTo("unit test consume build files") == 0 )
115
        if ( mGbebuildfilter.compareTo("unit test consume build files") == 0 )
112
        {
116
        {