ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/componentmanager/ComponentManager.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/componentmanager/ComponentManager.java (file contents):
Revision 1.31 by ajm, Thu Mar 1 16:36:52 2001 UTC vs.
Revision 1.32 by ajm, Thu Mar 1 16:49:49 2001 UTC

# Line 98 | Line 98 | public class ComponentManager {
98          // get the list of components
99          String componentList = System.getProperty("uk.ac.ukc.iscream.ComponentList");
100          StringTokenizer st = new StringTokenizer(componentList, ";");
101 <        ArrayList componentsToStart = new ArrayList();
101 >        _componentsToStart = new ArrayList();
102          
103          // this could be done using reflection
104          // but..well..we don't ;-p
# Line 128 | Line 128 | public class ComponentManager {
128              
129              // build the list of components to start
130              if (component != null) {
131 <                componentsToStart.add(component);    
131 >                _componentsToStart.add(component);    
132              } else {
133                  System.err.println(toString + ": WARNING unsupported component not started");
134              }
135          }
136          
137 <        // now we try and start the beast up        
138 <        boolean tryAgain = true;
139 <        Component component = null;
137 >        
138  
139          // get the value for timeout
140 <        int startTimeout = 0;
140 >        
141          String confTimeout = null;
142          try {
143              confTimeout = System.getProperty("uk.ac.ukc.iscream.ComponentTimeout");
144              confTimeout.trim();
145 <            startTimeout = Integer.parseInt(confTimeout);
145 >            _startTimeout = Integer.parseInt(confTimeout);
146          } catch (NumberFormatException e) {
147 <            startTimeout = DEFAULT_COMPONENT_START_TIMEOUT;
147 >            _startTimeout = DEFAULT_COMPONENT_START_TIMEOUT;
148              System.err.println(toString + ": unable to read uk.ac.ukc.iscream.ComponentTimeout value (" + confTimeout + "), using default!");
149          }
150 <        System.out.println(toString + ": using component start timeout of " + startTimeout + " seconds");
150 >        System.out.println(toString + ": using component start timeout of " + _startTimeout + " seconds");
151          
152          // startup the system components
153          startUp();
# Line 159 | Line 157 | public class ComponentManager {
157              while(true) {
158              try {
159                  refman.getORB().run();
160 <            } catch (org.omg.CORBA.COMM_FAILURE e) (
160 >            } catch (org.omg.CORBA.COMM_FAILURE e) {
161                  System.out.println(toString + ": WARNING CORBA communications failure - " + e.getMessage());
162                  System.out.println(toString + ": WARNING CORBA connections have been lost - attempting to restart!");
163              }
# Line 178 | Line 176 | public class ComponentManager {
176       * is called again.
177       */
178      private static void startUp() {
179 +        // now we try and start the beast up        
180 +        boolean tryAgain = true;
181 +        Component component = null;
182 +        
183          // keep trying until we've started all the components.
184          // maybe add support for a limited number of retries
185          while(tryAgain) {
186 <            Iterator i = componentsToStart.iterator();
186 >            Iterator i = _componentsToStart.iterator();
187              ArrayList failedComponents = new ArrayList();
188              // go through all the components
189              while(i.hasNext()) {
# Line 215 | Line 217 | public class ComponentManager {
217              // if we had some failed components that we can retry
218              if (failedComponents.size() > 0) {
219                  System.err.println(toString + ": WARNING One or more components failed to start correctly.");
220 <                System.err.println(toString + ": Will try again in " + startTimeout + " seconds");
220 >                System.err.println(toString + ": Will try again in " + _startTimeout + " seconds");
221              
222                  // our list is now the failed list
223 <                componentsToStart = failedComponents;
223 >                _componentsToStart = failedComponents;
224                  
225                  // sleep for a given timeout
226                  try {    
227 <                    Thread.sleep(startTimeout * 1000);
227 >                    Thread.sleep(_startTimeout * 1000);
228                  } catch (InterruptedException e) {
229                      // we're not bothered
230                  }
# Line 264 | Line 266 | public class ComponentManager {
266   //---ATTRIBUTES---
267      
268   //---STATIC ATTRIBUTES---
269 +
270 +    private static ArrayList _componentsToStart;
271 +    private static int _startTimeout = 0;
272  
273   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines