26 #include <Ice/Object.h>
27 #include <Ice/ObjectAdapter.h>
28 #include <Ice/PropertiesAdmin.h>
29 #include <IceUtil/Handle.h>
41 #include "ArmarXCore/interface/core/RemoteObjectNode.h"
42 #include "ArmarXCore/interface/core/UserException.h"
43 #include "ArmarXCore/interface/core/util/distributed/RemoteHandle/RemoteHandleControlBlock.h"
52 static const unsigned CORE_COUNT_STD = std::thread::hardware_concurrency();
56 static const unsigned CORE_COUNT_MIN = 1;
60 static const unsigned CORE_COUNT_DEFAULT =
std::max(CORE_COUNT_STD, CORE_COUNT_MIN);
64 return CORE_COUNT_DEFAULT;
70 ARMARX_DEBUG_S <<
"processor core count according to (std/requested from user) : "
71 << CORE_COUNT_STD <<
"/" << newCount;
83 std::lock_guard<std::mutex> lock {
dataMutex};
88 std::lock_guard<std::mutex> lock {
dataMutex};
93 std::lock_guard<std::mutex> lock {
dataMutex};
105 throw ServerShuttingDown {};
113 throw ServerShuttingDown {};
122 throw ServerShuttingDown {};
124 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
136 throw ServerShuttingDown {};
138 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
151 throw ServerShuttingDown {};
153 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
160 ident.name = registrationName;
167 throw ServerShuttingDown {};
169 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
176 ident.name = registrationName;
184 auto mioPrx = mioPtr->getProxy(-1);
185 return {std::move(mioPtr), std::move(mioPrx)};
191 throw NoSuchComponentFactory {
"There is no component factory for the name " + componentFactoryName};
198 return {std::move(ident), std::move(ioPrx)};
203 auto mioPtr = std::move(mio.
ptr);
212 [axManager, mioPtr, ron,
id]
214 axManager->removeObjectNonBlocking(mioPtr);
215 ron->removeRemoteHandledObject(id);
219 std::lock_guard<std::mutex> lock(
dataMutex);
222 mioRH.directHandle->forceDeletion();
223 throw ServerShuttingDown {};
227 return mioRH.clientSideRemoteHandleControlBlock;
231 auto ioIdent = std::move(io.
ident);
240 [objAdapter, ioIdent, ron,
id]
242 objAdapter->remove(ioIdent);
243 ron->removeRemoteHandledObject(id);
247 std::lock_guard<std::mutex> lock(
dataMutex);
250 ioRH.directHandle->forceDeletion();
251 throw ServerShuttingDown {};
255 return ioRH.clientSideRemoteHandleControlBlock;
260 std::lock_guard<std::mutex> lock(
dataMutex);
264 throw ServerShuttingDown {};
273 std::lock_guard<std::mutex> lock(
dataMutex);
277 throw ServerShuttingDown {};
286 std::lock_guard<std::mutex> lock(
dataMutex);
294 it->second->forceDeletion();
301 std::lock_guard<std::mutex> lock(
dataMutex);
304 elem.second->forceDeletion();
310 axManager->removeObjectBlocking(obj);
314 auto adapter = axManager->getAdapter();
317 adapter->remove(ident);