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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/CorbaControlHandlerServant.java (file contents):
Revision 1.6 by tdb, Wed Feb 28 19:04:00 2001 UTC vs.
Revision 1.12 by tdb, Fri Mar 16 02:14:40 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.clientinterface;
2 > package uk.org.iscream.clientinterface;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.util.*;
6 < import uk.ac.ukc.iscream.componentmanager.*;
7 < import uk.ac.ukc.iscream.core.*;
8 < import uk.ac.ukc.iscream.client.*;
5 > import uk.org.iscream.util.*;
6 > import uk.org.iscream.componentmanager.*;
7 > import uk.org.iscream.core.*;
8 > import uk.org.iscream.client.*;
9  
10  
11   /**
# Line 38 | Line 38 | class CorbaControlHandlerServant extends CorbaControlH
38       * @param queueMonitorInterval The interval at which to monitor our Queue.
39       * @param clientname A name to identify the client.
40       */
41 <    public CorbaControlHandlerServant(PacketSorter packetSorter, Client client, int queueMonitorInterval, String clientname) {
41 >    public CorbaControlHandlerServant(PacketSorter packetSorter, Client client, String clientname) {
42          _packetSorter = packetSorter;
43        _queueMonitorInterval = queueMonitorInterval;
43          _hostList = "";
44          _client = client;
45          _clientname = clientname;
# Line 58 | Line 57 | class CorbaControlHandlerServant extends CorbaControlH
57      public boolean startData() {
58          if(_dataHandler == null) {
59              // create a new DataHandler
60 <            CorbaDataHandler dh = new CorbaDataHandler(_client);
60 >            CorbaDataHandler dh = new CorbaDataHandler(_client, this);
61              // register the Queue
62              _packetSorter.register(dh.getQueue(), _hostList);
63 <            // startup a monitor on the DataHandler's queue, every minute
64 <            String queueName = _name + " CorbaHandler:"+_clientname;
65 <            dh.getQueue().startMonitor(_queueMonitorInterval*1000, _packetSorter.getQueue(), queueName);
63 >            try {
64 >                // startup a monitor on the DataHandler's queue
65 >                ConfigurationProxy cp = ConfigurationProxy.getInstance();
66 >                int queueMonitorInterval = Integer.parseInt(cp.getProperty("ClientInterface", "Queue.MonitorInterval"));
67 >                String queueName = _name + " CorbaHandler:"+_clientname;
68 >                dh.getQueue().startMonitor(queueMonitorInterval*1000, _packetSorter.getQueue(), queueName);
69 >            } catch (PropertyNotFoundException e) {
70 >                _logger.write(toString(), Logger.WARNING, "failed to find queue monitor config, disabling. " + e);
71 >            }
72              // start the DataHandler running
73              dh.start();
74              // keep a reference
# Line 113 | Line 118 | class CorbaControlHandlerServant extends CorbaControlH
118      }
119      
120      /**
121 +     * Disconnect, this will shutdown the data and unhook from
122 +     * the CORBA ORB.
123 +     */
124 +    public void disconnect() {
125 +        // close the data handler
126 +        stopData();
127 +        // disconnect from the ORB
128 +        try {
129 +            byte[] oid = _refman.getRootPOA().servant_to_id(this);
130 +            _refman.getRootPOA().deactivate_object(oid);
131 +        } catch(Exception e) {
132 +            _logger.write(this.toString(), Logger.ERROR, "disconnect failed: "+e);
133 +        }
134 +    }
135 +    
136 +    /**
137       * Overrides the {@link java.lang.Object#toString() Object.toString()}
138       * method to provide clean logging (every class should have this).
139       *
140 <     * This uses the uk.ac.ukc.iscream.util.NameFormat class
140 >     * This uses the uk.org.iscream.util.NameFormat class
141       * to format the toString()
142       *
143       * @return the name of this class and its CVS revision
# Line 130 | Line 151 | class CorbaControlHandlerServant extends CorbaControlH
151  
152   //---PRIVATE METHODS---
153  
154 +    /**
155 +     * Overridden for debugging purposes
156 +     * to see when an instance of this class
157 +     * is destroyed
158 +     */
159 +    protected void finalize() throws Throwable {
160 +        _logger.write(this.toString(), Logger.DEBUG, "finalized by GC");
161 +    }
162 +
163   //---ACCESSOR/MUTATOR METHODS---
164  
165   //---ATTRIBUTES---
# Line 150 | Line 180 | class CorbaControlHandlerServant extends CorbaControlH
180       * system logger that is being used.
181       */
182      private Logger _logger = ReferenceManager.getInstance().getLogger();
183 +
184 +    /**
185 +     * A reference to the reference manager in use
186 +     */
187 +    private ReferenceManager _refman = ReferenceManager.getInstance();
188      
189      /**
190           * A reference to the PacketSorter.
# Line 170 | Line 205 | class CorbaControlHandlerServant extends CorbaControlH
205       * A reference to our DataHandler, if we have one
206       */
207      private CorbaDataHandler _dataHandler;
173    
174    /**
175     * The interval at which to monitor our Queue
176     */
177    private int _queueMonitorInterval;
208      
209      /**
210       * A name to identify the client

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines