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.32 by ajm, Thu Mar 1 16:49:49 2001 UTC vs.
Revision 1.33 by tdb, Wed Mar 14 01:34:25 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 <        _componentsToStart = new ArrayList();
101 >        _componentsToStart = new LinkedList();
102          
103          // this could be done using reflection
104          // but..well..we don't ;-p
# Line 130 | Line 130 | public class ComponentManager {
130              if (component != null) {
131                  _componentsToStart.add(component);    
132              } else {
133 <                System.err.println(toString + ": WARNING unsupported component not started");
133 >                System.err.println(toString + ": WARNING unsupported component not started: "+componentName);
134              }
135          }
136          
# Line 154 | Line 154 | public class ComponentManager {
154  
155              // block on the ORB...in time, management functionality can be placed here.
156              // if we detect a CORBA communication error, we'll restart all the components.
157 +            // !! this doesn't appear to work !!
158              while(true) {
159              try {
160                  refman.getORB().run();
# Line 184 | Line 185 | public class ComponentManager {
185          // maybe add support for a limited number of retries
186          while(tryAgain) {
187              Iterator i = _componentsToStart.iterator();
188 <            ArrayList failedComponents = new ArrayList();
188 >            LinkedList failedComponents = new LinkedList();
189              // go through all the components
190              while(i.hasNext()) {
191 <                try {
192 <                    component = (Component) i.next();
193 <                    System.out.println(toString + ": starting component - " + component.toString());
194 <                    
195 <                    // start the component
196 <                    component.start();
197 <                    
198 <                // if we get this then there was a problem
199 <                // that we can't recover from
200 <                } catch (ComponentStartException e) {
201 <                    System.err.println(toString + ": ERROR starting component - " + component.toString());
202 <                    System.err.println(toString + ": component reports - " + e.getMessage());
203 <                    System.exit(1);
204 <
205 <                // if we get this exception then we've tried
206 <                // to talk to something which may not be up yet
207 <                // so we want to try again in a minute                
208 <                } catch(ComponentCORBAException e2) {
209 <                    System.err.println(toString + ": WARNING Component reported CORBA communications failure");
191 >                // get a refence to the component
192 >                component = (Component) i.next();
193 >                System.out.println(toString + ": starting component - " + component.toString());
194 >                
195 >                // check it's dependencies
196 >                boolean depOK = component.depCheck();
197 >                if(depOK) {
198 >                    // it should be ok to start the component
199 >                        try {    
200 >                            // start the component
201 >                        component.start();
202 >                    } catch (ComponentStartException e) {
203 >                        // if we get this then there was a problem
204 >                        // that we can't recover from
205 >                        System.err.println(toString + ": ERROR starting component - " + component.toString());
206 >                        System.err.println(toString + ": component reports - " + e.getMessage());
207 >                        System.exit(1);
208 >                    }
209 >                }
210 >                else {
211 >                    // it seems the depedencies failed
212 >                    // so we want to try again after a delay
213 >                    System.err.println(toString + ": WARNING Component reported dependency failure");
214                      System.err.println(toString + ": This could be because it can't communicate with components it needs.");
210                    System.err.println(toString + ": component reports - " + e2.getMessage());
215                      
216                      // make a list of the failed components
217                      failedComponents.add(component);
# Line 267 | Line 271 | public class ComponentManager {
271      
272   //---STATIC ATTRIBUTES---
273  
274 <    private static ArrayList _componentsToStart;
274 >    private static LinkedList _componentsToStart;
275      private static int _startTimeout = 0;
276  
277   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines