42 |
|
_logger = _refman.getLogger(); |
43 |
|
|
44 |
|
_logger.write(toString(), Logger.SYSINIT, "coming up"); |
45 |
– |
|
46 |
– |
// configuration variables we require |
47 |
– |
int queueMonitorInterval = 0; |
45 |
|
|
46 |
< |
Configuration config = _refman.getCM().getConfiguration("LocalClient"); |
47 |
< |
if (config == null) { |
48 |
< |
throw new ComponentStartException("Unable to obtain configuration for component"); |
49 |
< |
} |
50 |
< |
else { |
51 |
< |
try { |
52 |
< |
// get the configuration properties we need |
53 |
< |
queueMonitorInterval = Integer.parseInt(config.getProperty("Queue.MonitorInterval")); |
54 |
< |
} catch (org.omg.CORBA.MARSHAL e) { |
55 |
< |
throw new ComponentStartException("Unable to obtain requried configuration property for component"); |
46 |
> |
// get a reference to the configuration proxy |
47 |
> |
ConfigurationProxy cp = ConfigurationProxy.getInstance(); |
48 |
> |
|
49 |
> |
// see if these Queue's need a size limit |
50 |
> |
try { |
51 |
> |
int queueSizeLimit = Integer.parseInt(cp.getProperty(NAME, "Queue.SizeLimit")); |
52 |
> |
String queueRemoveAlgorithm = cp.getProperty(NAME, "Queue.RemoveAlgorithm"); |
53 |
> |
int algorithm = StringUtils.getStringPos(queueRemoveAlgorithm, Queue.algorithms); |
54 |
> |
if(algorithm != -1) { |
55 |
> |
_logger.write(toString(), Logger.DEBUG, "Starting 2 Queues with size limit of "+queueSizeLimit+", using remove algorithm "+queueRemoveAlgorithm); |
56 |
> |
// we have valid values, so lets start it. |
57 |
> |
_alerterQueue = new Queue(queueSizeLimit, algorithm); |
58 |
> |
_monitorQueue = new Queue(queueSizeLimit, algorithm); |
59 |
|
} |
60 |
+ |
else { |
61 |
+ |
_logger.write(toString(), Logger.WARNING, "Bad Queue Algorithm configuration, not known: "+queueRemoveAlgorithm); |
62 |
+ |
// just don't activate a limit |
63 |
+ |
_alerterQueue = new Queue(); |
64 |
+ |
_monitorQueue = new Queue(); |
65 |
+ |
} |
66 |
+ |
} catch (PropertyNotFoundException e) { |
67 |
+ |
_logger.write(toString(), Logger.DEBUG, "Optional config not set: "+e); |
68 |
+ |
// just don't activate a limit |
69 |
+ |
_alerterQueue = new Queue(); |
70 |
+ |
_monitorQueue = new Queue(); |
71 |
+ |
} catch (NumberFormatException e) { |
72 |
+ |
_logger.write(toString(), Logger.WARNING, "Bad Queue SizeLimit configuration: "+e); |
73 |
+ |
// just don't activate a limit |
74 |
+ |
_alerterQueue = new Queue(); |
75 |
+ |
_monitorQueue = new Queue(); |
76 |
|
} |
61 |
– |
|
62 |
– |
_logger.write(toString(), Logger.SYSINIT, "configured"); |
77 |
|
|
78 |
< |
// setup the queues, this must be done before both managers are setup |
79 |
< |
String queueName; |
80 |
< |
// setup a Queue for the servant -> monitor manager |
81 |
< |
_monitorQueue = new Queue(); |
82 |
< |
|
83 |
< |
// setup a Queue for the monitors -> alert manager |
84 |
< |
_alerterQueue = new Queue(); |
85 |
< |
|
86 |
< |
|
78 |
> |
// startup monitors on these queues |
79 |
> |
try { |
80 |
> |
// try to get the interval, if this fails, we won't start up the monitor |
81 |
> |
int queueMonitorInterval = Integer.parseInt(cp.getProperty(NAME, "Queue.MonitorInterval")); |
82 |
> |
_alerterQueue.startMonitor(queueMonitorInterval*1000, _monitorQueue, NAME + " DataQueue"); |
83 |
> |
_monitorQueue.startMonitor(queueMonitorInterval*1000, _monitorQueue, NAME + " HeartbeatQueue"); |
84 |
> |
} catch (PropertyNotFoundException e) { |
85 |
> |
_logger.write(toString(), Logger.WARNING, "failed to find queue monitor config, disabling. " + e); |
86 |
> |
} |
87 |
|
|
88 |
|
// setup the servant and connect |
89 |
|
_logger.write(toString(), Logger.SYSINIT, "starting servant and connecting"); |