Go to the documentation of this file.
31 #include <ArmarXCore/interface/core/ArmarXManagerInterface.h>
32 #include <ArmarXCore/interface/core/BasicTypes.h>
33 #include <ArmarXCore/interface/core/MiceManagerInsightProvider.h>
36 #include <condition_variable>
43 #include <Ice/BuiltinSequences.h>
44 #include <Ice/CommunicatorF.h>
45 #include <Ice/Current.h>
46 #include <Ice/Metrics.h>
47 #include <Ice/ObjectAdapterF.h>
48 #include <Ice/Properties.h>
49 #include <IceUtil/Handle.h>
54 class ArmarXObjectScheduler;
62 class ArmarXMultipleObjectsScheduler;
99 virtual public ArmarXManagerInterface,
105 enum ArmarXManagerState
127 std::string host =
"localhost",
128 std::string locatorName =
"IceGrid/Locator",
129 Ice::StringSeq args = Ice::StringSeq());
183 bool addWithOwnAdapter =
true,
184 const std::string& objectName =
"",
185 bool useOwnScheduleThread =
true)
override;
187 const std::string& objectName,
188 bool addWithOwnAdapter =
true,
189 bool useOwnScheduleThread =
true);
193 const std::string& objectName =
"",
194 bool useOwnScheduleThread =
true);
197 const std::string& objectName,
198 bool addWithOwnAdapter =
true,
199 bool useOwnScheduleThread =
true);
279 ManagedIceObjectState
getObjectState(
const std::string& objectName,
280 const Ice::Current&
c = Ice::emptyCurrent)
override;
290 ManagedIceObjectConnectivity
292 const Ice::Current&
c = Ice::emptyCurrent)
override;
302 mice::MiceObjectConnectivity
304 const Ice::Current&
c = Ice::emptyCurrent)
override;
310 ::armarx::StringStringDictionary
312 const ::Ice::Current& = Ice::emptyCurrent)
override;
314 const ::Ice::Current&)
override;
318 Ice::PropertiesAdminPrx
321 IceMX::MetricsAdminPrx
getMetricsAdmin(
const Ice::Current& = Ice::emptyCurrent)
override;
347 Ice::StringSeq
getObjectNames(
const Ice::Current&
c = Ice::emptyCurrent)
override;
357 std::string
getHostname(
const Ice::Current&
c = Ice::emptyCurrent)
override;
395 template <
class Function,
class Data>
399 const std::string&
id =
"",
401 IceUtil::Time orphantDeletionDelay = IceUtil::Time::seconds(6),
402 long heartBeatMs = 1000)
407 std::forward<decltype(f)>(f),
408 std::forward<decltype(d)>(d),
410 orphantDeletionDelay,
412 remoteReferenceCountControlBlockManager->add(ptr);
416 template <
class Function>
419 const std::string&
id =
"",
421 IceUtil::Time orphantDeletionDelay = IceUtil::Time::seconds(6),
422 long heartBeatMs = 1000)
427 std::forward<decltype(f)>(f),
429 orphantDeletionDelay,
431 remoteReferenceCountControlBlockManager->add(ptr);
435 template <
class Function,
class Data>
439 const std::string&
id =
"",
446 std::forward<decltype(f)>(f),
447 std::forward<decltype(d)>(d),
449 remoteReferenceCountControlBlockManager->add(ptr);
453 template <
class Function>
456 const std::string&
id =
"",
461 this,
id, std::forward<decltype(f)>(f), deletionDelay);
462 remoteReferenceCountControlBlockManager->add(ptr);
473 using ObjectSchedulerMap = std::map<std::string, ArmarXObjectSchedulerPtr>;
474 using ObjectSchedulerList = std::vector<ArmarXObjectSchedulerPtr>;
480 void cleanupSchedulers();
486 void disconnectDependees(
const std::string&
object);
487 void disconnectAllObjects();
488 std::vector<std::string> getDependendees(
const std::string& removedObject);
495 void wakeupWaitingSchedulers();
498 void removeAllObjects(
bool blocking);
505 void checkDependencies();
522 void installProcessFacet();
525 std::string applicationName;
528 ArmarXManagerState managerState;
529 std::mutex managerStateMutex;
537 ObjectSchedulerMap managedObjects;
538 ObjectSchedulerList terminatingObjects;
539 mutable std::recursive_mutex managedObjectsMutex;
540 std::mutex terminatingObjectsMutex;
542 std::mutex schedulerListMutex;
543 std::vector<ArmarXMultipleObjectsSchedulerPtr> singleThreadedSchedulers;
546 std::mutex shutdownMutex;
547 std::condition_variable shutdownCondition;
556 std::shared_ptr<SharedRemoteHandleState> sharedRemoteHandleState;
557 std::shared_ptr<RemoteReferenceCountControlBlockManager>
558 remoteReferenceCountControlBlockManager;
void setComponentIceProperties(const Ice::PropertiesPtr &properties)
Calls Component::setIceProperties() on all components assigend to this ArmarXManager Instance.
IceUtil::Handle< IceManager > IceManagerPtr
IceManager smart pointer.
ObjectPropertyInfos getApplicationPropertyInfos(const ::Ice::Current &) override
virtual void addObjectAsync(const ManagedIceObjectPtr &object, const std::string &objectName, bool addWithOwnAdapter=true, bool useOwnScheduleThread=true)
ObjectPropertyInfos getObjectPropertyInfos(const ::std::string &objectName, const ::Ice::Current &) override
MessageTypeT minimumLoggingLevel
std::map< std::string, VariantBasePtr > StringVariantBaseMap
void waitForShutdown()
Wait for shutdown.
ArmarXManager(std::string applicationName, int port=4061, std::string host="localhost", std::string locatorName="IceGrid/Locator", Ice::StringSeq args=Ice::StringSeq())
ArmarXManager constructor.
This holds the shared state of all RemoteHandleControlBlocks for one armarx manager.
void enableProfiling(bool enable)
Enable or disable profiling of CPU Usage.
const Ice::ObjectAdapterPtr & getAdapter() const
The ArmarXObjectObserver inherits from IceGrid::ObjectObserver and signals its associated ArmarXManag...
SimpleRemoteReferenceCountControlBlockPtr< Function, Data > createSimpleRemoteReferenceCount(Function f, Data d, const std::string &id="", IceUtil::Time deletionDelay=IceUtil::Time::seconds(3))
static bool CheckIceConnection(const Ice::CommunicatorPtr &communicator, bool printHint)
void increaseSchedulers(int increaseBy)
increased the number of single threaded schedulers.
IceMX::MetricsAdminPrx getMetricsAdmin(const Ice::Current &=Ice::emptyCurrent) override
bool isShutdown()
Whether ArmarXManager shutdown has been finished.
SimpleRemoteReferenceCountControlBlockPtr< Function > createSimpleRemoteReferenceCount(Function f, const std::string &id="", IceUtil::Time deletionDelay=IceUtil::Time::seconds(3))
StringVariantBaseMap getMetaInfo(const std::string &, const Ice::Current &) override
std::vector< ManagedIceObjectPtr > getManagedObjects() override
Retrieve pointers to all ManagedIceObject.
std::string getHostname(const Ice::Current &c=Ice::emptyCurrent) override
Gets the hostname of the host running the manager.
const std::shared_ptr< SharedRemoteHandleState > & getSharedRemoteHandleState() const
void updateComponentIceProperties(const Ice::PropertyDict &properties)
Ice::PropertiesAdminPrx getPropertiesAdmin(const Ice::Current &=Ice::emptyCurrent) override
void removeObjectNonBlocking(const ManagedIceObjectPtr &object) override
Removes an object from the manager.
void addObject(const ManagedIceObjectPtr &object, bool addWithOwnAdapter=true, const std::string &objectName="", bool useOwnScheduleThread=true) override
Add a ManagedIceObject to the manager.
The registery interface is implemented by ArmarXManagers.
void enableLogging(bool enable)
Enable or disable logging.
bool checkIceConnection(bool printHint=true) const
IceUtil::Handle< ArmarXObjectScheduler > ArmarXObjectSchedulerPtr
ManagedIceObjectState getObjectState(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
Retrieve state of a ManagedIceObject.
armarx::core::time::DateTime Time
Ice::StringSeq getObjectNames(const Ice::Current &c=Ice::emptyCurrent) override
Retrieve the names of all ManagedIceObject.
::armarx::StringStringDictionary getObjectProperties(const ::std::string &objectName, const ::Ice::Current &=Ice::emptyCurrent) override
getObjectProperties is used to retrieve the properties of an object
mice::MiceObjectConnectivity getMiceObjectConnectivity(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
Retrieve connectivity of a ManagedIceObject.
Base Class for all Logging classes.
void setDataPaths(std::string dataPaths)
Set data paths used to search for datafiles.
RemoteReferenceCountControlBlockPtr< Function > createRemoteReferenceCount(Function f, const std::string &id="", IceUtil::Time deletionDelay=IceUtil::Time::seconds(3), IceUtil::Time orphantDeletionDelay=IceUtil::Time::seconds(6), long heartBeatMs=1000)
ManagedIceObjectConnectivity getObjectConnectivity(const std::string &objectName, const Ice::Current &c=Ice::emptyCurrent) override
Retrieve connectivity of a ManagedIceObject.
Ice::StringSeq getManagedObjectNames(const Ice::Current &c=Ice::emptyCurrent) override
Retrieve the names of all ManagedIceObject.
void removeObjectBlocking(const ManagedIceObjectPtr &object) override
Removes an object from the manager.
void registerKnownObjectFactoriesWithIce()
non static convenience version of ArmarXManager::RegisterKnownObjectFactoriesWithIce()
RemoteReferenceCountControlBlockPtr< Function, Data > createRemoteReferenceCount(Function f, Data d, const std::string &id="", IceUtil::Time deletionDelay=IceUtil::Time::seconds(3), IceUtil::Time orphantDeletionDelay=IceUtil::Time::seconds(6), long heartBeatMs=1000)
void shutdown()
Shuts down the ArmarXManager.
std::shared_ptr< ScopedRecursiveLock > ScopedRecursiveLockPtr
~ArmarXManager() override
const Ice::CommunicatorPtr & getCommunicator() const
Main class of an ArmarX process.
This file offers overloads of toIce() and fromIce() functions for STL container types.
static void RegisterKnownObjectFactoriesWithIce(const Ice::CommunicatorPtr &ic)
Registers all object factories that are known with Ice.
void asyncShutdown(std::size_t timeoutMs=0)
Calls shutdown() after a timeout.
void setGlobalMinimumLoggingLevel(MessageTypeT minimumLoggingLevel)
Set minimum logging level to output in log stream.
const IceManagerPtr & getIceManager() const
Retrieve the instance of the icemanager.