24 #include "ArmarXCore/interface/core/RemoteObjectNode.h"
32 #include <Ice/Object.h>
33 #include <Ice/ObjectAdapter.h>
34 #include <Ice/PropertiesAdmin.h>
35 #include <IceUtil/Handle.h>
41 #include "ArmarXCore/interface/core/UserException.h"
42 #include "ArmarXCore/interface/core/util/distributed/RemoteHandle/RemoteHandleControlBlock.h"
53 static const unsigned CORE_COUNT_STD = std::thread::hardware_concurrency();
57 static const unsigned CORE_COUNT_MIN = 1;
61 static const unsigned CORE_COUNT_DEFAULT =
std::max(CORE_COUNT_STD, CORE_COUNT_MIN);
66 return CORE_COUNT_DEFAULT;
73 ARMARX_DEBUG_S <<
"processor core count according to (std/requested from user) : "
74 << CORE_COUNT_STD <<
"/" << newCount;
88 std::lock_guard<std::mutex> lock{
dataMutex};
96 std::lock_guard<std::mutex> lock{
dataMutex};
103 std::lock_guard<std::mutex> lock{
dataMutex};
115 const std::string& registrationName,
116 const ComponentParameter& params,
121 throw ServerShuttingDown{};
127 ClientSideRemoteHandleControlBlockBasePtr
129 const std::string& registrationName,
130 const ComponentParameter& params,
135 throw ServerShuttingDown{};
148 throw ServerShuttingDown{};
150 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
160 ClientSideRemoteHandleControlBlockBasePtr
167 throw ServerShuttingDown{};
169 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
186 throw ServerShuttingDown{};
188 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
196 ident.name = registrationName;
200 ClientSideRemoteHandleControlBlockBasePtr
207 throw ServerShuttingDown{};
209 auto mioPtr = ManagedIceObjectPtr::dynamicCast(registree);
217 ident.name = registrationName;
223 std::string registrationName)
227 auto mioPrx = mioPtr->getProxy(-1);
228 return {std::move(mioPtr), std::move(mioPrx)};
233 const std::string& registrationName,
234 const ComponentParameter& params)
238 throw NoSuchComponentFactory{
"There is no component factory for the name " +
239 componentFactoryName};
242 params.prop, params.configName, params.configDomain),
250 return {std::move(ident), std::move(ioPrx)};
253 ClientSideRemoteHandleControlBlockBasePtr
257 auto mioPtr = std::move(mio.
ptr);
266 [axManager, mioPtr, ron,
id]
268 axManager->removeObjectNonBlocking(mioPtr);
269 ron->removeRemoteHandledObject(id);
272 std::lock_guard<std::mutex> lock(
dataMutex);
275 mioRH.directHandle->forceDeletion();
276 throw ServerShuttingDown{};
280 return mioRH.clientSideRemoteHandleControlBlock;
283 ClientSideRemoteHandleControlBlockBasePtr
287 auto ioIdent = std::move(io.
ident);
295 [objAdapter, ioIdent, ron,
id]
297 objAdapter->remove(ioIdent);
298 ron->removeRemoteHandledObject(id);
301 std::lock_guard<std::mutex> lock(
dataMutex);
304 ioRH.directHandle->forceDeletion();
305 throw ServerShuttingDown{};
309 return ioRH.clientSideRemoteHandleControlBlock;
317 std::lock_guard<std::mutex> lock(
dataMutex);
321 throw ServerShuttingDown{};
333 std::lock_guard<std::mutex> lock(
dataMutex);
337 throw ServerShuttingDown{};
347 std::lock_guard<std::mutex> lock(
dataMutex);
355 it->second->forceDeletion();
363 std::lock_guard<std::mutex> lock(
dataMutex);
366 elem.second->forceDeletion();
372 axManager->removeObjectBlocking(obj);
376 auto adapter = axManager->getAdapter();
379 adapter->remove(ident);