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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReader.java (file contents):
Revision 1.3 by tdb, Thu Nov 30 02:00:54 2000 UTC vs.
Revision 1.8 by tdb, Sun Jan 28 05:34:38 2001 UTC

# Line 3 | Line 3 | package uk.ac.ukc.iscream.filter;
3  
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.core.*;
6 + import uk.ac.ukc.iscream.componentmanager.*;
7   import uk.ac.ukc.iscream.filter.*;
8   import java.net.Socket;
9   import java.net.ServerSocket;
# Line 10 | Line 11 | import java.io.OutputStream;
11   import java.io.IOException;
12   import java.net.InetAddress;
13   import java.net.UnknownHostException;
14 < import org.omg.CORBA.*;
14 < import org.omg.CosNaming.*;
15 < import uk.ac.ukc.iscream.refman.*;
14 > import uk.ac.ukc.iscream.util.*;
15  
16   /**
17 < * A socket listener to listen for new hosts registering with the system.
19 < * When a host makes a connection, the connecton is past to an instance
20 < * of the HostInit class, which handles further communication.
17 > * Reads TCP Heartbeats from the host applications.
18   *
19   * @author  $Author$
20   * @version $Id$
# Line 36 | Line 33 | class TCPReader extends Thread {
33   //---CONSTRUCTORS---
34  
35          /**
36 <     * Constructs a new listener
36 >     * Constructs a new TCPReader
37       *
38 <     * @param logger a reference to the logger we are using
39 <     * @param configManager a reference to the ConfigurationManager we are using
43 <         * @param port The port that the server will listen on.
38 >     * @param queue A reference to our Queue
39 >         * @param port The port that the TCPReader will listen on
40           */
41 <    public TCPReader(int port, Filter parent) {
41 >    public TCPReader(int port, Queue queue) {
42          _port = port;
43 <        _parent = parent;
43 >        _queue = queue;
44          _logger.write(toString(), Logger.SYSINIT, "started");
45      }
46  
# Line 96 | Line 92 | class TCPReader extends Thread {
92                          // If we've stopped on the line above we won't want to try this !
93              if(run){
94                                  try {
95 <                                    // Setup the HostInit so it can carry on communications with the host
96 <                    TCPReaderInit init = new TCPReaderInit(hostSocket, _parent);
95 >                                    // Setup the TCPReaderInit and start it
96 >                    TCPReaderInit init = new TCPReaderInit(hostSocket, _queue);
97                                      // and start it
98                      init.start();
99                  } catch (IOException e) {
# Line 113 | Line 109 | class TCPReader extends Thread {
109       * Overrides the {@link java.lang.Object#toString() Object.toString()}
110       * method to provide clean logging (every class should have this).
111       *
112 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
113 +     * to format the toString()
114 +     *
115       * @return the name of this class and its CVS revision
116       */
117      public String toString() {
118 <        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
118 >        return FormatName.getName(
119 >            _name,
120 >            getClass().getName(),
121 >            REVISION);
122      }
123  
124   //---PRIVATE METHODS---
# Line 126 | Line 128 | class TCPReader extends Thread {
128   //---ATTRIBUTES---
129      
130      /**
131 <     * A reference to the logger the system is using
131 >     * This is the friendly identifier of the
132 >     * component this class is running in.
133 >     * eg, a Filter may be called "filter1",
134 >     * If this class does not have an owning
135 >     * component,  a name from the configuration
136 >     * can be placed here.  This name could also
137 >     * be changed to null for utility classes.
138       */
139 <    Logger _logger = ReferenceManager.getInstance().getLogger();
139 >    private String _name = FilterMain.NAME;
140 >
141 >    /**
142 >     * This holds a reference to the
143 >     * system logger that is being used.
144 >     */
145 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
146      
147      /**
148           * The port on which the server should listen.
149           */
150      private int _port;
151      
152 <    private Filter _parent;
152 >    /**
153 >     * A reference to our Queue
154 >     */
155 >    private Queue _queue;
156      
157   //---STATIC ATTRIBUTES---
158  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines