9 |
|
|
10 |
|
/** |
11 |
|
* This class, a servant, listens for incoming connections from CORBA based |
12 |
< |
* clients. Once it receives a connection it creates and assigns a CorbaHandler |
13 |
< |
* object to it. The CorbaHandler will then handle all requests on behalf of the |
12 |
> |
* clients. Once it receives a connection it creates and assigns a CorbaControlHandler |
13 |
> |
* object to it. The CorbaControlHandler will then handle all requests on behalf of the |
14 |
|
* client, and will send the client data. |
15 |
|
* |
16 |
|
* @author $Author$ |
33 |
|
* Creates a new CorbaClientListenerServant. |
34 |
|
* |
35 |
|
* @param packetSorter a reference to the PacketSorter object being used |
36 |
+ |
* @param queueMonitorInterval the interval at which to monitor the Queue |
37 |
|
*/ |
38 |
< |
public CorbaClientListenerServant(PacketSorter packetSorter) { |
38 |
> |
public CorbaClientListenerServant(PacketSorter packetSorter, int queueMonitorInterval) { |
39 |
|
_packetSorter = packetSorter; |
40 |
+ |
_queueMonitorInterval = queueMonitorInterval; |
41 |
|
_logger.write(toString(), Logger.SYSINIT, "created"); |
42 |
|
} |
43 |
|
|
46 |
|
/** |
47 |
|
* Allows a CORBA client to connect to the server. |
48 |
|
* |
47 |
– |
* @param name the name of the connecting client. |
49 |
|
* @param client a reference to the "servant" part of the connecting client. |
50 |
< |
* @return a CorbaHandler reference. |
50 |
> |
* @param name a name to identify the client. |
51 |
> |
* @return a CorbaControlHandler reference. |
52 |
|
*/ |
53 |
< |
public CorbaHandler connect(String name, Client client) { |
54 |
< |
CorbaHandlerServant chServant = new CorbaHandlerServant(_packetSorter, name, client); |
53 |
< |
CorbaHandlerPOATie chPOATie = new CorbaHandlerPOATie(chServant); |
53 |
> |
public CorbaControlHandler connect(Client client, String name) { |
54 |
> |
CorbaControlHandlerServant cchServant = new CorbaControlHandlerServant(_packetSorter, client, _queueMonitorInterval, name); |
55 |
|
org.omg.CORBA.Object objRef; |
56 |
|
try { |
57 |
< |
objRef = _refman.getRootPOA().servant_to_reference(chPOATie); |
57 |
> |
objRef = _refman.getRootPOA().servant_to_reference(cchServant); |
58 |
|
} catch (Exception e) { |
59 |
|
objRef = null; |
60 |
< |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaHandler: "+e); |
60 |
> |
_logger.write(toString(), Logger.ERROR, "Error creating CorbaControlHandler: "+e); |
61 |
|
} |
62 |
< |
CorbaHandler corbaHandler = CorbaHandlerHelper.narrow(objRef); |
62 |
< |
((Thread) corbaHandler).start(); |
62 |
> |
CorbaControlHandler corbaHandler = CorbaControlHandlerHelper.narrow(objRef); |
63 |
|
return corbaHandler; |
64 |
|
} |
65 |
|
|
111 |
|
* A reference to the PacketSorter. |
112 |
|
*/ |
113 |
|
private PacketSorter _packetSorter; |
114 |
+ |
|
115 |
+ |
/** |
116 |
+ |
* The interval at which to monitor Queues. |
117 |
+ |
*/ |
118 |
+ |
private int _queueMonitorInterval; |
119 |
|
|
120 |
|
//---STATIC ATTRIBUTES--- |
121 |
|
|