components = new TreeMap<String, ServerComponent>();
registrators = new TreeMap<String, ComponentRegistrator>();
receivers = new TreeMap<String, MessageReceiver>();
setConfig(config);
MessageRouterConfig conf = new MessageRouterConfig(props);
String[] reg_names = conf.getRegistrNames();
for (String name: reg_names) {
ComponentRegistrator cr = tmp_reg.remove(name);
String cls_name =
(String)props.get(REGISTRATOR_PROP_KEY + name + ".class");
try {
if (cr == null || !cr.getClass().getName().equals(cls_name)) {
if (cr != null) {
cr.release();
}
cr = conf.getRegistrInstance(name);
cr.setName(name);
} // end of if (cr == null)
addRegistrator(cr);
} // end of try
catch (Exception e) {
e.printStackTrace();
} // end of try-catch
} // end of for (String name: reg_names)
for (ComponentRegistrator cr: tmp_reg.values()) {
cr.release();
} // end of for ()
tmp_reg.clear();
String[] msgrcv_names = conf.getMsgRcvNames();
for (String name: msgrcv_names) {
log.finer("Loading and registering message receiver: " + name);
ServerComponent mr = tmp_rec.remove(name);
String cls_name =
(String)props.get(MSG_RECEIVERS_PROP_KEY + name + ".class");
try {
if (mr == null || !mr.getClass().getName().equals(cls_name)) {
if (mr != null) {
mr.release();
}
mr = conf.getMsgRcvInstance(name);
mr.setName(name);
if (mr instanceof MessageReceiver) {
((MessageReceiver)mr).setParent(this);
((MessageReceiver)mr).start();
}