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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/rootfilter/RootFilter.java (file contents):
Revision 1.10 by ajm, Tue Dec 12 19:54:55 2000 UTC vs.
Revision 1.21 by tdb, Fri Jan 19 01:20:15 2001 UTC

# Line 4 | Line 4 | package uk.ac.ukc.iscream.rootfilter;
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.util.*;
6   import uk.ac.ukc.iscream.core.*;
7 + import uk.ac.ukc.iscream.componentmanager.*;
8   import uk.ac.ukc.iscream.clientinterface.*;
9  
10   /**
# Line 17 | Line 18 | import uk.ac.ukc.iscream.clientinterface.*;
18   * @author  $Author$
19   * @version $Id$
20   */
21 < public class RootFilter implements uk.ac.ukc.iscream.util.Component {
21 > public class RootFilter implements Component {
22  
23   //---FINAL ATTRIBUTES---
24  
# Line 66 | Line 67 | public class RootFilter implements uk.ac.ukc.iscream.u
67          NAME = ourName;
68          
69          _logger.write(toString(), Logger.SYSINIT, "configured");
70 <                
70 >        
71 >        ClientInterface ciReal = null, ciDB = null;
72          // get reference to the client interfaces - the real time one
73 <        ClientInterface ciReal = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + realInterface));
73 >        if (realInterface != null) {
74 >            ciReal = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + realInterface));
75 >        }
76          // get reference to the client interfaces - and the db one
77 <        ClientInterface ciDB = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + dbInterface));
78 <        _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface);
77 >        if (dbInterface != null) {
78 >            ciDB = ClientInterfaceHelper.narrow(_refman.getCORBARef("iscream.ClientInterface." + dbInterface));
79 >        }
80          
81 <        ClientInterface[] clientInterfaces = {ciReal, ciDB};
81 >        Queue queue = new Queue();
82          
83 +        if (realInterface == null) {        
84 +            _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + dbInterface);
85 +            CIWrapper c = new CIWrapper(ciDB, queue);
86 +            c.start();
87 +        } else if (dbInterface == null) {
88 +            _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface);
89 +            CIWrapper c = new CIWrapper(ciReal, queue);
90 +            c.start();
91 +        } else {
92 +            _logger.write(toString(), Logger.DEBUG, "hooked to interfaces - " + realInterface + " & " + dbInterface);
93 +            CIWrapper c = new CIWrapper(ciReal, queue);
94 +            c.start();
95 +            c = new CIWrapper(ciDB, queue);
96 +            c.start();
97 +        }
98 +                
99          // RootFilterServant start (for inbound child filter data)
100          _logger.write(toString(), Logger.DEBUG, "starting Root Filter");
101 <        RootFilterServant filterServant = new RootFilterServant(clientInterfaces);
101 >        RootFilterServant filterServant = new RootFilterServant(queue);
102          // bind to the naming service as a filter
103 <        _refman.bindToOrb(filterServant, "iscream.Filter." + _name);
103 >        _refman.bindToOrb(filterServant, "iscream.Filter." + RootFilter.NAME);
104          
105          _logger.write(toString(), Logger.SYSINIT, "started");
106 +        
107 +        // !!!! TEMPORARY CODE !!!!
108 +        // Monitor the queue's status (queue 0 and 1 - big assumption!)
109 +        while(true) {
110 +            // wait 30 seconds
111 +            try { Thread.sleep(30000); } catch(Exception e) {}
112 +            try {
113 +                int q0 = queue.queueSize(0);
114 +                int q1 = queue.queueSize(1);
115 +                int tot = queue.elementCount();
116 +                String message = "Queue status - queue0: "+q0+" queue1: "+q1+" total: "+tot;
117 +                _logger.write(toString(), Logger.DEBUG, message);
118 +            }
119 +            catch(Exception e) {
120 +                _logger.write(toString(), Logger.ERROR, e.getMessage());
121 +            }
122 +        }
123      }
124      
125      /**
# Line 95 | Line 133 | public class RootFilter implements uk.ac.ukc.iscream.u
133       */
134      public String toString() {
135          return FormatName.getName(
136 <            _name,
136 >            NAME,
137              getClass().getName(),
138              REVISION);
139      }
# Line 105 | Line 143 | public class RootFilter implements uk.ac.ukc.iscream.u
143   //---ACCESSOR/MUTATOR METHODS---
144  
145   //---ATTRIBUTES---
108
109    /**
110     * This is the friendly identifier of the
111     * component this class is running in.
112     * eg, a Filter may be called "filter1",
113     * If this class does not have an owning
114     * component,  a name from the configuration
115     * can be placed here.  This name could also
116     * be changed to null for utility classes.
117     */
118    private String _name = RootFilter.NAME;
146  
147      /**
148       * This holds a reference to the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines