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.3 by tdb, Mon Feb 5 00:58:46 2001 UTC vs.
Revision 1.11 by tdb, Fri Mar 16 01:50:36 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 35 | Line 35 | class CorbaControlHandlerServant extends CorbaControlH
35       *
36       * @param packetSorter A reference to the PacketSorter in the component
37       * @param client A reference to the "servant" part of the connecting client.
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) {
41 >    public CorbaControlHandlerServant(PacketSorter packetSorter, Client client, String clientname) {
42          _packetSorter = packetSorter;
43          _hostList = "";
44          _client = client;
45 +        _clientname = clientname;
46          _dataHandler = null;
47          _logger.write(toString(), Logger.SYSINIT, "created");
48      }
# Line 54 | 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 +            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 106 | 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 143 | Line 171 | class CorbaControlHandlerServant extends CorbaControlH
171       * system logger that is being used.
172       */
173      private Logger _logger = ReferenceManager.getInstance().getLogger();
174 +
175 +    /**
176 +     * A reference to the reference manager in use
177 +     */
178 +    private ReferenceManager _refman = ReferenceManager.getInstance();
179      
180      /**
181           * A reference to the PacketSorter.
# Line 163 | Line 196 | class CorbaControlHandlerServant extends CorbaControlH
196       * A reference to our DataHandler, if we have one
197       */
198      private CorbaDataHandler _dataHandler;
199 +    
200 +    /**
201 +     * A name to identify the client
202 +     */
203 +    private String _clientname;
204      
205   //---STATIC ATTRIBUTES---
206  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines