Go to the documentation of this file.
31 #include <ArmarXCore/interface/core/MiceManagerInsightProvider.h>
32 #include <ArmarXCore/interface/core/ArmarXManagerInterface.h>
33 #include <ArmarXCore/interface/core/BasicTypes.h>
36 #include <Ice/BuiltinSequences.h>
37 #include <Ice/CommunicatorF.h>
38 #include <Ice/Current.h>
39 #include <Ice/ObjectAdapterF.h>
40 #include <Ice/Properties.h>
41 #include <Ice/Metrics.h>
42 #include <IceUtil/Handle.h>
44 #include <condition_variable>
54 class ArmarXObjectScheduler;
62 class ArmarXMultipleObjectsScheduler;
99 virtual public ArmarXManagerInterface,
105 enum ArmarXManagerState
125 ArmarXManager(std::string applicationName,
int port = 4061, std::string host =
"localhost", std::string locatorName =
"IceGrid/Locator", Ice::StringSeq args = Ice::StringSeq());
178 void addObject(
const ManagedIceObjectPtr&
object,
bool addWithOwnAdapter =
true,
const std::string& objectName =
"",
bool useOwnScheduleThread =
true)
override;
179 virtual void addObject(
const ManagedIceObjectPtr&
object,
const std::string& objectName,
bool addWithOwnAdapter =
true,
bool useOwnScheduleThread =
true);
263 ManagedIceObjectState
getObjectState(
const std::string& objectName,
const Ice::Current&
c = Ice::emptyCurrent)
override;
273 ManagedIceObjectConnectivity
getObjectConnectivity(
const std::string& objectName,
const Ice::Current&
c = Ice::emptyCurrent)
override;
283 mice::MiceObjectConnectivity
getMiceObjectConnectivity(
const std::string& objectName,
const Ice::Current&
c = Ice::emptyCurrent)
override;
289 ::armarx::StringStringDictionary
getObjectProperties(const ::std::string& objectName, const ::Ice::Current& = Ice::emptyCurrent)
override;
290 ObjectPropertyInfos
getObjectPropertyInfos(const::std::string& objectName, const::Ice::Current&)
override;
294 Ice::PropertiesAdminPrx
getPropertiesAdmin(
const Ice::Current& = Ice::emptyCurrent)
override;
296 IceMX::MetricsAdminPrx
getMetricsAdmin(
const Ice::Current& = Ice::emptyCurrent)
override;
322 Ice::StringSeq
getObjectNames(
const Ice::Current&
c = Ice::emptyCurrent)
override;
332 std::string
getHostname(
const Ice::Current&
c = Ice::emptyCurrent)
override;
370 template<
class Function,
class Data>
372 Function f, Data d,
const std::string&
id =
"",
374 IceUtil::Time orphantDeletionDelay = IceUtil::Time::seconds(6),
375 long heartBeatMs = 1000)
380 this,
id, std::forward<decltype(f)>(f), std::forward<decltype(d)>(d),
381 deletionDelay, orphantDeletionDelay, heartBeatMs
383 remoteReferenceCountControlBlockManager->add(ptr);
386 template<
class Function>
388 Function f,
const std::string&
id =
"",
390 IceUtil::Time orphantDeletionDelay = IceUtil::Time::seconds(6),
391 long heartBeatMs = 1000)
396 this,
id, std::forward<decltype(f)>(f),
397 deletionDelay, orphantDeletionDelay, heartBeatMs
399 remoteReferenceCountControlBlockManager->add(ptr);
403 template<
class Function,
class Data>
406 Function f, Data d,
const std::string&
id =
"",
IceUtil::Time deletionDelay = IceUtil::Time::seconds(3))
411 this,
id, std::forward<decltype(f)>(f), std::forward<decltype(d)>(d), deletionDelay
413 remoteReferenceCountControlBlockManager->add(ptr);
416 template<
class Function>
419 Function f,
const std::string&
id =
"",
IceUtil::Time deletionDelay = IceUtil::Time::seconds(3))
424 this,
id, std::forward<decltype(f)>(f), deletionDelay
426 remoteReferenceCountControlBlockManager->add(ptr);
437 using ObjectSchedulerMap = std::map<std::string, ArmarXObjectSchedulerPtr>;
438 using ObjectSchedulerList = std::vector<ArmarXObjectSchedulerPtr>;
444 void cleanupSchedulers();
450 void disconnectDependees(
const std::string&
object);
451 void disconnectAllObjects();
452 std::vector<std::string> getDependendees(
const std::string& removedObject);
459 void wakeupWaitingSchedulers();
462 void removeAllObjects(
bool blocking);
469 void checkDependencies();
486 void installProcessFacet();
489 std::string applicationName;
492 ArmarXManagerState managerState;
493 std::mutex managerStateMutex;
501 ObjectSchedulerMap managedObjects;
502 ObjectSchedulerList terminatingObjects;
503 mutable std::recursive_mutex managedObjectsMutex;
504 std::mutex terminatingObjectsMutex;
506 std::mutex schedulerListMutex;
507 std::vector<ArmarXMultipleObjectsSchedulerPtr> singleThreadedSchedulers;
510 std::mutex shutdownMutex;
511 std::condition_variable shutdownCondition;
520 std::shared_ptr<SharedRemoteHandleState> sharedRemoteHandleState;
521 std::shared_ptr<RemoteReferenceCountControlBlockManager> 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.