47 |
|
* |
48 |
|
* @param socket The Socket connected to the new Client |
49 |
|
* @param packetSorter A reference to the PacketSorter in the component |
50 |
– |
* @param queueMonitorInterval The interval at which to monitor our Queue |
50 |
|
*/ |
51 |
< |
public TCPControlHandler(Socket socket, PacketSorter packetSorter, int queueMonitorInterval) throws IOException { |
51 |
> |
public TCPControlHandler(Socket socket, PacketSorter packetSorter) throws IOException { |
52 |
|
// set the Thread name |
53 |
|
setName("clientinterface.TCPControlHandler"); |
54 |
|
|
55 |
|
_socket = socket; |
56 |
|
_packetSorter = packetSorter; |
58 |
– |
_queueMonitorInterval = queueMonitorInterval; |
57 |
|
// setup the reader & writer |
58 |
|
_socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream())); |
59 |
|
_socketOut = new PrintWriter(_socket.getOutputStream(), true); |
143 |
|
TCPDataHandler dh = new TCPDataHandler(s); |
144 |
|
// register the DataHandler's queue, giving the host list |
145 |
|
_packetSorter.register(dh.getQueue(), _hostList); |
146 |
< |
// startup a monitor on the DataHandler's queue, every minute |
147 |
< |
String queueName = _name + " TCPHandler:"+_socket.getInetAddress().getHostName(); |
148 |
< |
dh.getQueue().startMonitor(_queueMonitorInterval*1000, _packetSorter.getQueue(), queueName); |
146 |
> |
try { |
147 |
> |
// startup a monitor on the DataHandler's queue |
148 |
> |
ConfigurationProxy cp = ConfigurationProxy.getInstance(); |
149 |
> |
int queueMonitorInterval = Integer.parseInt(cp.getProperty("ClientInterface", "Queue.MonitorInterval")); |
150 |
> |
String queueName = _name + " TCPHandler:"+_socket.getInetAddress().getHostName(); |
151 |
> |
dh.getQueue().startMonitor(queueMonitorInterval*1000, _packetSorter.getQueue(), queueName); |
152 |
> |
} catch (PropertyNotFoundException e) { |
153 |
> |
_logger.write(toString(), Logger.WARNING, "failed to find queue monitor config, disabling. " + e); |
154 |
> |
} |
155 |
|
// start up the DataHandler |
156 |
|
dh.start(); |
157 |
|
// Hold a reference to the DataHandler, so we can stop it later |
346 |
|
* The host list the Client has requested |
347 |
|
*/ |
348 |
|
private String _hostList; |
345 |
– |
|
346 |
– |
/** |
347 |
– |
* The interval at which to monitor our Queue |
348 |
– |
*/ |
349 |
– |
private int _queueMonitorInterval; |
349 |
|
|
350 |
|
//---STATIC ATTRIBUTES--- |
351 |
|
|