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

Comparing projects/cms/source/server/uk/org/iscream/cms/server/filter/UDPReader.java (file contents):
Revision 1.10 by ajm, Wed Dec 13 13:36:46 2000 UTC vs.
Revision 1.12 by tdb, Fri Jan 12 00:45:25 2001 UTC

# Line 24 | Line 24 | public class UDPReader extends Thread{
24       * The current CVS revision of this class
25       */
26      public final String REVISION = "$Revision$";
27 +
28 +    /**
29 +     * The maximum size of a packet
30 +     */
31 +    private final int packetSizeLimit = 8192;  
32      
33   //---STATIC METHODS---
34  
# Line 33 | Line 38 | public class UDPReader extends Thread{
38       * It is normal to use this constructor in preference
39       * to any other in this class.
40       */
41 <    public UDPReader(int port, Filter parent){
41 >    public UDPReader(int port, Queue queue){
42          _port = port;
43 <        _parent = parent;
43 >        _queue = queue;
44      }
45  
46   //---PUBLIC METHODS---
# Line 63 | Line 68 | public class UDPReader extends Thread{
68          while (running){
69              try {
70  
71 <                    // receive request and pass on to the FilterThread.                
71 >                    // receive request and put it in the Queue              
72                  buf = new byte[packetSizeLimit];
73                  DatagramPacket packet = new DatagramPacket(buf, buf.length);
74                  socket.receive(packet);
75 <                FilterThread t = new FilterThread(packet, _parent);
76 <                t.start();
72 <
75 >                String xml = new String(packet.getData());
76 >                _queue.add(xml);
77              }
78              catch (IOException e) {
79                  _logger.write(this.toString(), Logger.WARNING, "This UDPReader thread has been shut down as an exception occured: "+e);
# Line 83 | Line 87 | public class UDPReader extends Thread{
87       * Overrides the {@link java.lang.Object#toString() Object.toString()}
88       * method to provide clean logging (every class should have this).
89       *
90 +     * This uses the uk.ac.ukc.iscream.util.NameFormat class
91 +     * to format the toString()
92 +     *
93       * @return the name of this class and its CVS revision
94       */
95      public String toString() {
96 <        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
96 >        return FormatName.getName(
97 >            _name,
98 >            getClass().getName(),
99 >            REVISION);
100      }
101  
102   //---PRIVATE METHODS---
# Line 95 | Line 105 | public class UDPReader extends Thread{
105  
106   //---ATTRIBUTES---
107  
108 <    Logger _logger = ReferenceManager.getInstance().getLogger();
109 <    int _port;
110 <    Filter _parent;    
108 >    /**
109 >     * This is the friendly identifier of the
110 >     * component this class is running in.
111 >     * eg, a Filter may be called "filter1",
112 >     * If this class does not have an owning
113 >     * component,  a name from the configuration
114 >     * can be placed here.  This name could also
115 >     * be changed to null for utility classes.
116 >     */
117 >    private String _name = FilterMain.NAME;
118  
119 <    final int packetSizeLimit = 8192;
119 >    /**
120 >     * This holds a reference to the
121 >     * system logger that is being used.
122 >     */
123 >    private Logger _logger = ReferenceManager.getInstance().getLogger();
124 >    
125 >    /**
126 >     * The port that this reader is using
127 >     */
128 >    int _port;
129 >    
130 >    /**
131 >     * The Queue object
132 >     */
133 >    Queue _queue;    
134  
135   //---STATIC ATTRIBUTES---
136  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines