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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/PacketSorter.java (file contents):
Revision 1.17 by tdb, Fri Mar 16 16:11:31 2001 UTC vs.
Revision 1.26 by tdb, Sun Sep 25 09:57:41 2005 UTC

# Line 1 | Line 1
1 + /*
2 + * i-scream central monitoring system
3 + * http://www.i-scream.org
4 + * Copyright (C) 2000-2002 i-scream
5 + *
6 + * This program is free software; you can redistribute it and/or
7 + * modify it under the terms of the GNU General Public License
8 + * as published by the Free Software Foundation; either version 2
9 + * of the License, or (at your option) any later version.
10 + *
11 + * This program is distributed in the hope that it will be useful,
12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 + * GNU General Public License for more details.
15 + *
16 + * You should have received a copy of the GNU General Public License
17 + * along with this program; if not, write to the Free Software
18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + */
20 +
21   //---PACKAGE DECLARATION---
22 < package uk.org.iscream.clientinterface;
22 > package uk.org.iscream.cms.server.clientinterface;
23  
24   //---IMPORTS---
25 < import uk.org.iscream.util.*;
26 < import uk.org.iscream.componentmanager.*;
27 < import uk.org.iscream.core.*;
28 < import java.util.*;
25 > import uk.org.iscream.cms.util.*;
26 > import uk.org.iscream.cms.server.componentmanager.*;
27 > import uk.org.iscream.cms.server.core.*;
28 > import java.util.HashMap;
29 > import java.util.Iterator;
30 > import java.util.LinkedList;
31 > import java.util.List;
32 > import java.util.StringTokenizer;
33  
34   /**
35   * Receives data from the incoming CORBA servant, places
# Line 90 | Line 114 | class PacketSorter extends Thread {
114       * loop forever processing and sending data.
115       */
116      public void run() {
93        XMLPacketMaker xmlPacketMaker = new XMLPacketMaker();
117          int qID = _queue.getQueue();
118          while(true) {
119              // attempt to get some data from the Queue
# Line 105 | Line 128 | class PacketSorter extends Thread {
128              XMLPacket packet = null;
129              
130              try {
131 <                packet = xmlPacketMaker.createXMLPacket(xml);
131 >                packet = _xmlCache.getXMLPacket(xml);
132              } catch(InvalidXMLException e) {
133                  _logger.write(toString(), Logger.ERROR, "Invalid XML: "+e);
134                  // skip the rest of this loop iteration
135                  continue;
136              }
137              
138 +            if(packet == null) {
139 +                continue;
140 +            }
141 +            
142              String packetType = packet.getParam("packet.attributes.type");
143              // check if we need to send it regardless
144 <            if(packetType.equals("data") || packetType.equals("heartbeat")) {
144 >            if(packetType.equals("data")) {
145                  String host = packet.getParam("packet.attributes.machine_name");
146                  
147                  // look in the hostMap to see if anyone wants this data
# Line 248 | Line 275 | class PacketSorter extends Thread {
275       * Overrides the {@link java.lang.Object#toString() Object.toString()}
276       * method to provide clean logging (every class should have this).
277       *
278 <     * This uses the uk.org.iscream.util.NameFormat class
278 >     * This uses the uk.org.iscream.cms.util.NameFormat class
279       * to format the toString()
280       *
281       * @return the name of this class and its CVS revision
# Line 315 | Line 342 | class PacketSorter extends Thread {
342       * A list of all hosts.
343       */
344      private LinkedList _allHostsList;
345 +    
346 +    /**
347 +     * A reference to the XMLCache in use
348 +     */
349 +    private XMLCache _xmlCache = XMLCache.getInstance();
350      
351   //---STATIC ATTRIBUTES---
352  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines