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.18 by tdb, Tue May 29 17:02:34 2001 UTC vs.
Revision 1.25 by tdb, Wed Dec 8 14:50:32 2004 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.cms.server.clientinterface;
23  
24   //---IMPORTS---
25 < import uk.org.iscream.cms.server.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.*;
# Line 90 | Line 110 | class PacketSorter extends Thread {
110       * loop forever processing and sending data.
111       */
112      public void run() {
93        XMLPacketMaker xmlPacketMaker = new XMLPacketMaker();
113          int qID = _queue.getQueue();
114          while(true) {
115              // attempt to get some data from the Queue
# Line 105 | Line 124 | class PacketSorter extends Thread {
124              XMLPacket packet = null;
125              
126              try {
127 <                packet = xmlPacketMaker.createXMLPacket(xml);
127 >                packet = _xmlCache.getXMLPacket(xml);
128              } catch(InvalidXMLException e) {
129                  _logger.write(toString(), Logger.ERROR, "Invalid XML: "+e);
130                  // skip the rest of this loop iteration
131                  continue;
132              }
133              
134 +            if(packet == null) {
135 +                continue;
136 +            }
137 +            
138              String packetType = packet.getParam("packet.attributes.type");
139              // check if we need to send it regardless
140 <            if(packetType.equals("data") || packetType.equals("heartbeat")) {
140 >            if(packetType.equals("data")) {
141                  String host = packet.getParam("packet.attributes.machine_name");
142                  
143                  // look in the hostMap to see if anyone wants this data
# Line 248 | Line 271 | class PacketSorter extends Thread {
271       * Overrides the {@link java.lang.Object#toString() Object.toString()}
272       * method to provide clean logging (every class should have this).
273       *
274 <     * This uses the uk.org.iscream.cms.server.util.NameFormat class
274 >     * This uses the uk.org.iscream.cms.util.NameFormat class
275       * to format the toString()
276       *
277       * @return the name of this class and its CVS revision
# Line 315 | Line 338 | class PacketSorter extends Thread {
338       * A list of all hosts.
339       */
340      private LinkedList _allHostsList;
341 +    
342 +    /**
343 +     * A reference to the XMLCache in use
344 +     */
345 +    private XMLCache _xmlCache = XMLCache.getInstance();
346      
347   //---STATIC ATTRIBUTES---
348  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines