1 |
|
//---PACKAGE DECLARATION--- |
2 |
< |
package uk.ac.ukc.iscream.filter; |
2 |
> |
package uk.org.iscream.filter; |
3 |
|
|
4 |
|
//---IMPORTS--- |
5 |
< |
import uk.ac.ukc.iscream.core.*; |
6 |
< |
import uk.ac.ukc.iscream.componentmanager.*; |
7 |
< |
import uk.ac.ukc.iscream.filter.*; |
5 |
> |
import uk.org.iscream.core.*; |
6 |
> |
import uk.org.iscream.componentmanager.*; |
7 |
> |
import uk.org.iscream.filter.*; |
8 |
|
import java.net.Socket; |
9 |
|
import java.net.ServerSocket; |
10 |
|
import java.io.OutputStream; |
11 |
|
import java.io.IOException; |
12 |
|
import java.net.InetAddress; |
13 |
|
import java.net.UnknownHostException; |
14 |
< |
import uk.ac.ukc.iscream.util.*; |
14 |
> |
import uk.org.iscream.util.*; |
15 |
|
|
16 |
|
/** |
17 |
|
* Reads TCP Heartbeats from the host applications. |
39 |
|
* @param port The port that the TCPReader will listen on |
40 |
|
*/ |
41 |
|
public TCPReader(int port, Queue queue) { |
42 |
+ |
// set the Thread name |
43 |
+ |
setName("filter.TCPReader"); |
44 |
+ |
|
45 |
|
_port = port; |
46 |
|
_queue = queue; |
47 |
|
_logger.write(toString(), Logger.SYSINIT, "started"); |
83 |
|
while(run){ |
84 |
|
Socket hostSocket=null; |
85 |
|
try{ |
86 |
< |
_logger.write(toString(), Logger.SYSMSG, "Waiting for Connection"); |
86 |
> |
_logger.write(toString(), Logger.DEBUG, "Waiting for Connection"); |
87 |
|
// This will block until a host connects - at which point we get a Socket |
88 |
|
hostSocket = listenPort.accept(); |
89 |
< |
_logger.write(toString(), Logger.SYSMSG, "Connection accepted from: " + hostSocket.toString()); |
89 |
> |
_logger.write(toString(), Logger.DEBUG, "Connection accepted from: " + hostSocket.toString()); |
90 |
|
} |
91 |
|
catch(IOException e){ |
92 |
|
// Something went wrong with the ServerSocket, so we'll stop listening |
112 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
113 |
|
* method to provide clean logging (every class should have this). |
114 |
|
* |
115 |
< |
* This uses the uk.ac.ukc.iscream.util.NameFormat class |
115 |
> |
* This uses the uk.org.iscream.util.NameFormat class |
116 |
|
* to format the toString() |
117 |
|
* |
118 |
|
* @return the name of this class and its CVS revision |