[openrtm-commit:02827] r1047 - branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 9月 15日 (金) 14:32:51 JST
Author: kawauchi
Date: 2017-09-15 14:32:51 +0900 (Fri, 15 Sep 2017)
New Revision: 1047
Modified:
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
Log:
[merge] r1043-1045 have been merged from trunk.
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-15 05:30:31 UTC (rev 1046)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/DefaultConfiguration.java 2017-09-15 05:32:51 UTC (rev 1047)
@@ -70,6 +70,9 @@
"sdo.service.provider.enabled_services", "ALL",
"sdo.service.consumer.enabled_services", "ALL",
"manager.local_service.enabled_services","ALL",
+ "manager.modules.C++.load_paths", "./",
+ "manager.modules.Python.load_paths", "./",
+ "manager.modules.Java.load_paths", "./",
""
};
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-15 05:30:31 UTC (rev 1046)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2017-09-15 05:32:51 UTC (rev 1047)
@@ -1745,6 +1745,8 @@
Properties prop = new Properties();
int i,len;
FactoryBase factory = findPropertyFormFactory(comp_id);
+ rtcout.println(Logbuf.PARANOID,
+ "findPropertyFormFactory(comp_id):" +factory);
if (factory == null) {
rtcout.println(Logbuf.ERROR,
"Factory not found: "
@@ -1833,6 +1835,8 @@
}
comp = factory.create(this);
+ rtcout.println(Logbuf.PARANOID,
+ "factory.create(this):" +comp);
if (comp == null) {
rtcout.println(Logbuf.ERROR,
"RTC creation failed: "
@@ -2836,6 +2840,10 @@
rtcout.println(Logbuf.ERROR, "Unknown Exception");
}
}
+
+ String form = m_config.getProperty("manager.instance_name");
+ String i_name = formatString(form,m_config);
+ m_config.setProperty("manager.instance_name",i_name);
}
/**
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-15 05:30:31 UTC (rev 1046)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/ManagerServant.java 2017-09-15 05:32:51 UTC (rev 1047)
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
+import java.util.regex.Matcher;
import jp.go.aist.rtm.RTC.log.Logbuf;
import jp.go.aist.rtm.RTC.util.CORBA_SeqUtil;
@@ -555,20 +556,32 @@
rtcout.println(Logbuf.TRACE, "create_component("+module_name+")");
RTC.RTObject rtc = create_component_by_address(module_name);
+ rtcout.println(Logbuf.PARANOID, "create_component_by_address():"+rtc);
if(rtc != null){
return rtc;
}
rtc = create_component_by_mgrname(module_name);
+ rtcout.println(Logbuf.PARANOID, "create_component_by_mgrname():"+rtc);
if(rtc != null){
return rtc;
}
+ String[] temp = new String[1];
+ temp[0] = module_name;
+ get_parameter_by_modulename("manager_address",temp);
+ String manager_name = new String();
+ manager_name = get_parameter_by_modulename("manager_name",temp);
+ rtcout.println(Logbuf.PARANOID, "m_isMaster:"+m_isMaster);
if(m_isMaster){
synchronized(m_slaveMutex) {
+ rtcout.println(Logbuf.PARANOID,
+ "m_slaves.length:"+m_slaves.length);
for (int ic=0; ic < m_slaves.length; ++ic) {
try {
rtc = m_slaves[ic].create_component(module_name);
+ rtcout.println(Logbuf.PARANOID,
+ "m_slaves[ic].create_component():" +rtc);
if(rtc != null){
return rtc;
}
@@ -580,16 +593,30 @@
}
}
}
+ rtcout.println(Logbuf.PARANOID,
+ "manager_name:"+manager_name);
+ if(manager_name==null){
+ String name = module_name + "&manager_name=manager_%p";
+
+ rtc = create_component_by_mgrname(name);
+ rtcout.println(Logbuf.PARANOID,
+ "create_component_by_mgrname("
+ +name
+ +"):"
+ +rtc);
+ return rtc;
+ }
}
-
-
- // create on this manager
+ else {
+ // create on this manager
- RTObject_impl rtobj = m_mgr.createComponent(module_name);
- if(rtobj != null){
- return rtobj.getObjRef();
+ RTObject_impl rtobj = m_mgr.createComponent(module_name);
+ rtcout.println(Logbuf.PARANOID,
+ "m_mgr.createComponent():" +rtobj);
+ if(rtobj != null){
+ return rtobj.getObjRef();
+ }
}
-
return null;
}
@@ -1393,6 +1420,10 @@
*
*/
public RTC.RTObject create_component_by_mgrname(String module_name) {
+ rtcout.println(Logbuf.PARANOID,
+ "create_component_by_mgrname("
+ +module_name
+ +")");
String arg = module_name;
String[] tmp = new String[1];
tmp[0] = arg;
@@ -1399,6 +1430,9 @@
String mgrstr = get_parameter_by_modulename("manager_name",tmp);
arg = tmp[0];
+ rtcout.println(Logbuf.PARANOID,
+ "get_parameter_by_modulename(\"manager_name\",tmp):"
+ +mgrstr);
if(mgrstr==null){
return null;
}
@@ -1406,7 +1440,18 @@
return null;
}
- RTM.Manager mgrobj = findManager_by_name(mgrstr);
+ RTM.Manager mgrobj;
+ if(mgrstr.equals("manager_%p")){
+ mgrobj = null;
+ }
+ else{
+ mgrobj = findManager_by_name(mgrstr);
+ rtcout.println(Logbuf.PARANOID,
+ "findManager_by_name("
+ +mgrstr
+ +"):"
+ +mgrobj);
+ }
tmp[0] = arg;
String language = get_parameter_by_modulename("language",tmp);
@@ -1427,6 +1472,14 @@
if(rtcd_cmd.isEmpty()){
rtcd_cmd = "rtcd_java";
}
+
+ String load_path = config.getProperty("manager.modules.load_path");
+ String load_path_language = config.getProperty(
+ "manager.modules."
+ +language
+ +".load_paths");
+ load_path = load_path + "," + load_path_language;
+
List<String> cmd = new ArrayList();
cmd.add(rtcd_cmd);
cmd.add("-o");
@@ -1441,6 +1494,10 @@
cmd.add("manager.name:"+man_name);
cmd.add("-o");
cmd.add("manager.instance_name:"+mgrstr);
+ cmd.add("-o");
+ cmd.add("manager.modules.load_path:"+load_path);
+ cmd.add("-o");
+ cmd.add("manager.shutdown_auto:YES");
/*
String cmd = rtcd_cmd;
cmd += " -o " + "manager.is_master:NO";
@@ -1454,6 +1511,7 @@
rtcout.println(Logbuf.DEBUG, "Invoking command: "+ cmd + ".");
try{
ProcessBuilder pb = new ProcessBuilder(cmd);
+ pb.redirectErrorStream(true);
Process p = pb.start();
}
catch(Exception ex){
@@ -1468,8 +1526,54 @@
//do nothing
}
int count = 0;
+
+ ArrayList slaves_name = new ArrayList();
+ java.util.regex.Pattern pattern
+ = java.util.regex.Pattern.compile(
+ "^manager_[0-9]+$");
+
+ if(mgrstr.equals("manager_%p")){
+ synchronized (m_slaveMutex) {
+ for (int ic=0; ic < m_slaves.length; ++ic) {
+ _SDOPackage.NameValue[] prof
+ = m_slaves[ic]. get_configuration();
+ NVListHolder nvholder =
+ new NVListHolder(prof);
+ Properties proper = new Properties();
+ NVUtil.copyToProperties(proper, nvholder);
+ String i_name
+ = proper.getProperty("manager.instance_name");
+ Matcher matcher = pattern.matcher(i_name);
+ if(matcher.matches()){
+ slaves_name.add(i_name);
+ }
+ }
+ }
+ }
+
while (mgrobj == null) {
- mgrobj = findManager_by_name(mgrstr);
+ if(mgrstr.equals("manager_%p")){
+ synchronized (m_slaveMutex) {
+ for (int ic=0; ic < m_slaves.length; ++ic) {
+ _SDOPackage.NameValue[] prof
+ = m_slaves[ic]. get_configuration();
+ NVListHolder nvholder =
+ new NVListHolder(prof);
+ Properties proper = new Properties();
+ NVUtil.copyToProperties(proper, nvholder);
+ String i_name
+ = proper.getProperty("manager.instance_name");
+ Matcher matcher = pattern.matcher(i_name);
+ if(matcher.matches() &&
+ !slaves_name.contains(i_name)){
+ mgrobj = m_slaves[ic];
+ }
+ }
+ }
+ }
+ else{
+ mgrobj = findManager_by_name(mgrstr);
+ }
++count;
if (count > 1000) {
break;
@@ -1565,11 +1669,21 @@
if(rtcd_cmd.isEmpty()){
rtcd_cmd = "rtcd_java";
}
+
+ String load_path = config.getProperty("manager.modules.load_path");
+ String load_path_language = config.getProperty(
+ "manager.modules."
+ +language
+ +".load_paths");
+ load_path = load_path + "," + load_path_language;
+
List<String> cmd = new ArrayList();
cmd.add(rtcd_cmd);
cmd.add("-p");
cmd.add(mgrvstr[1]);
+ cmd.add("-o");
+ cmd.add("manager.modules.load_path:"+load_path);
rtcout.println(Logbuf.DEBUG, "Invoking command: "+ cmd + ".");
More information about the openrtm-commit
mailing list