TimeServer autodiscovery
Autodiscovery is handled using the standard object lifecycle in armarx:
With UseTimeServer=1 we always start a LocalTimeServer which does a usingProxy(GLOBAL_TIMESERVER_NAME). As soon as one exists LocalTimeServer::onConnect handles switching TimeUtil to virtual time and triggers a reset of all components. If the global timeserver vanishes, the LocalTimeServer is disconnected and onDisconnect sets TimeUtil back to system time and triggers the reset, too.
Autodiscovery of TimeServer instances at runtime requires the following changes:
-
ArmarX.UseTimeServershould default to1. The meaning will change to "use a timeserver if one is present or discovered at runtime by default and prevent this behavior by setting the property to 0". -
Add methods to the TimeServer Slice interface for reporting when a TimeServer has been started and when a TimeServer has been stopped. -
Change existing TimeServer implemenations to call the new methods inonConnect()andonDisconnect()/onExit(). -
Change LocalTimeServerstartup in ArmarXManager so that it is always started whenUseTimeServeris1but not registered withTimeUtil::SetTimeServer -
In LocalTimeServer::onConnectandonDisconnectregister or respectively deregister usingTimeUtil::SetTimeServer(...), reset all components
Applications must react to TimeServer instances appearing and disappearing at runtime
-
Switch to using the newly started TimeServer when ArmarX.UseTimeServeris equal to1. -
Switch to using the system time when the used TimeServer instance is stopped. -
Reset Component instances by disconnecting them. The reset is necessary because the huge changes in timestamps might result in unspecified behavior.