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.11 by tdb, Fri Jan 12 00:45:25 2001 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines