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/TCPReaderInit.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java (file contents):
Revision 1.8 by tdb, Thu Nov 30 02:00:55 2000 UTC vs.
Revision 1.12 by tdb, Thu Jan 18 23:13:36 2001 UTC

# Line 4 | Line 4 | package uk.ac.ukc.iscream.filter;
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.core.*;
6   import uk.ac.ukc.iscream.filter.*;
7 + import uk.ac.ukc.iscream.componentmanager.*;
8   import java.net.Socket;
9   import java.io.InputStream;
10   import java.io.OutputStream;
11   import java.io.IOException;
12   import java.io.*;
13 < import org.omg.CORBA.*;
13 < import org.omg.CosNaming.*;
14 < import uk.ac.ukc.iscream.refman.*;
13 > import uk.ac.ukc.iscream.util.*;
14  
15   /**
16 < * <ONE LINE DESCRIPTION>
18 < * <DETAILED DESCRIPTION>
16 > * This provides Host heartbeat functionality
17   *
18   * @author  $Author$
19   * @version $Id$
# Line 33 | Line 31 | class TCPReaderInit extends Thread {
31  
32   //---CONSTRUCTORS---
33  
34 <    public TCPReaderInit(Socket socket, Filter parent) throws IOException {
34 >    public TCPReaderInit(Socket socket, Queue queue) throws IOException {
35          _socket = socket;
36 <        _parent = parent;
36 >        _queue = queue;
37          _socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream()));
38          _socketOut = new PrintWriter(_socket.getOutputStream());
39          _logger.write(toString(), Logger.SYSINIT, "created");
# Line 103 | Line 101 | class TCPReaderInit extends Thread {
101              String ipadd = _socket.getInetAddress().getHostAddress();
102              String xml = "<packet type=\"heartbeat\" machine_name=\""+hostname+"\" date=\""+date+"\" ip=\""+ipadd+"\"></packet>";
103              
104 <            FilterThread t = new FilterThread(xml, _parent);
107 <            t.start();
104 >            _queue.add(xml);
105              
106          } catch (Exception e) {
107              _logger.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage());
# Line 126 | Line 123 | class TCPReaderInit extends Thread {
123       * Overrides the {@link java.lang.Object#toString() Object.toString()}
124       * method to provide clean logging (every class should have this).
125       *
126 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
127 +     * to format the toString()
128 +     *
129       * @return the name of this class and its CVS revision
130       */
131      public String toString() {
132 <        return this.getClass().getName() + "{" + _socket.getInetAddress().getHostName()
133 <         + "}(" + REVISION.substring(11, REVISION.length() - 2) + ")";
134 <        
132 >        return FormatName.getName(
133 >            _name,
134 >            getClass().getName(),
135 >            REVISION);
136      }
137  
138   //---PRIVATE METHODS---
# Line 140 | Line 141 | class TCPReaderInit extends Thread {
141  
142   //---ATTRIBUTES---
143  
144 +    /**
145 +     * A reference to the configuration manager
146 +     */
147      ConfigurationManager _configManager = ReferenceManager.getInstance().getCM();
148 <    Logger _logger = ReferenceManager.getInstance().getLogger();
148 >    
149 >    /**
150 >     * This is the friendly identifier of the
151 >     * component this class is running in.
152 >     * eg, a Filter may be called "filter1",
153 >     * If this class does not have an owning
154 >     * component,  a name from the configuration
155 >     * can be placed here.  This name could also
156 >     * be changed to null for utility classes.
157 >     */
158 >    private String _name = FilterMain.NAME;
159 >
160 >    /**
161 >     * This holds a reference to the
162 >     * system logger that is being used.
163 >     */
164 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
165 >    
166 >    /**
167 >     * The socket we are talking on
168 >     */
169      Socket _socket;
170 +    
171 +    /**
172 +     * The input from the socket
173 +     */
174      BufferedReader _socketIn;
175 +    
176 +    /**
177 +     * The output from the socket
178 +     */
179      PrintWriter _socketOut;
180 <    Filter _parent;
180 >    
181 >    /**
182 >     * A reference to our Queue
183 >     */
184 >    Queue _queue;
185   //---STATIC ATTRIBUTES---
186  
187   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines