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--- |
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(); |
77 |
< |
|
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); |
128 |
|
int _port; |
129 |
|
|
130 |
|
/** |
131 |
< |
* The parent of this filter |
131 |
> |
* The Queue object |
132 |
|
*/ |
133 |
< |
Filter _parent; |
133 |
> |
Queue _queue; |
134 |
|
|
135 |
|
//---STATIC ATTRIBUTES--- |
136 |
|
|