RemoteReferenceCount.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarX
19  * @author Raphael Grimm( raphael dor grimm at kit dot edu)
20  * @date 2017
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include <thread>
25 #include <queue>
26 #include <chrono>
27 
28 #include <Ice/Initialize.h> // for stringToIdentity
29 #include <Ice/ObjectAdapter.h>
30 #include <IceUtil/UUID.h>
31 
32 #include "RemoteReferenceCount.h"
35 #include "ArmarXManager.h"
36 
37 
38 namespace armarx
39 {
40 
41  class RemoteReferenceCounter;
43 
45  {
46  public:
47  static void Add(RemoteReferenceCounter* ptr)
48  {
49  Instance().add(ptr);
50  }
51  static void Remove(RemoteReferenceCounter* ptr)
52  {
53  Instance().remove(ptr);
54  }
55  private:
56  void add(RemoteReferenceCounter* ptr);
57  void remove(RemoteReferenceCounter* ptr);
58  static HeartbeatMonitor& Instance();
60 
61  void heartbeatTask();
62 
63  std::mutex mtx;
64  std::thread t;
65  std::atomic_bool shutdown {false};
66  HeartbeatMonitor() = default;
67  using PqEntry = std::pair<IceUtil::Time, RemoteReferenceCounter*>;
68  struct PqEntryCompare
69  {
70  bool operator()(const PqEntry& lhs, const PqEntry& rhs) const
71  {
72  return lhs.first > rhs.first;
73  }
74  };
75  std::priority_queue<PqEntry,
76  std::vector<PqEntry>,
77  PqEntryCompare> entries;
78  std::set<void*> entriesToDelete;
79  static const IceUtil::Time maximalSleepTime;
80  };
81  const IceUtil::Time HeartbeatMonitor::maximalSleepTime = IceUtil::Time::milliSeconds(100);
82 
83  class RemoteReferenceCounter : virtual public RemoteReferenceCounterBase
84  {
85  public:
86  RemoteReferenceCounter() = default;
87  RemoteReferenceCounter(const RemoteReferenceCountControlBlockInterfacePrx& prx, const std::string& id, Ice::Long heartBeatMs)
88  : RemoteReferenceCounterBase(prx, id, heartBeatMs)
89  {
91  }
92  RemoteReferenceCounter(const RemoteReferenceCounter& other) : RemoteReferenceCounter(other.block, other.id, other.heartBeatMs) {}
93 
95  {
96  if (block)
97  {
98  block->removeCounter(counterId);
99  }
101  }
102 
103  RemoteReferenceCounterBasePtr copy(const Ice::Current& = Ice::emptyCurrent) const final override
104  {
105  return new RemoteReferenceCounter {*this};
106  }
107  std::string getId(const Ice::Current& = Ice::emptyCurrent) const final override
108  {
109  return id;
110  }
111  void ice_postUnmarshal() override
112  {
113  block->addCounter(counterId);
114  HeartbeatMonitor::Add(this);
115  }
117  {
118  block->heartbeat(counterId);
119  return now + IceUtil::Time::milliSeconds(heartBeatMs);
120  }
121  private:
122  const std::string counterId
123  {
124  IceUtil::generateUUID()
125  };
126  };
127 
128  class SimpleRemoteReferenceCounter : virtual public SimpleRemoteReferenceCounterBase
129  {
130  public:
131  SimpleRemoteReferenceCounter() = default;
132  SimpleRemoteReferenceCounter(const SimpleRemoteReferenceCountControlBlockInterfacePrx& prx, const std::string& id) : SimpleRemoteReferenceCounterBase(prx, id)
133  {
135  }
137 
139  {
140  if (block)
141  {
142  block->removeCounter(counterId);
143  }
144  }
145 
146  SimpleRemoteReferenceCounterBasePtr copy(const Ice::Current& = Ice::emptyCurrent) const final override
147  {
148  return new SimpleRemoteReferenceCounter {*this};
149  }
150  std::string getId(const Ice::Current& = Ice::emptyCurrent) const final override
151  {
152  return id;
153  }
154  void ice_postUnmarshal() override
155  {
156  block->addCounter(counterId);
157  }
158  private:
159  const std::string counterId
160  {
161  IceUtil::generateUUID()
162  };
163  };
164 
165  HeartbeatMonitor& HeartbeatMonitor::Instance()
166  {
167  static HeartbeatMonitor monitor;
168  return monitor;
169  }
170  void HeartbeatMonitor::add(RemoteReferenceCounter* ptr)
171  {
172  std::lock_guard<std::mutex> guard {mtx};
173 
174  if (!t.joinable())
175  {
176  t = std::thread {[this]{heartbeatTask();}};
177  }
178  entries.emplace(ptr->heartbeat(IceUtil::Time::now()), ptr);
179  }
180  void HeartbeatMonitor::remove(RemoteReferenceCounter* ptr)
181  {
182  std::lock_guard<std::mutex> guard {mtx};
183  entriesToDelete.emplace(ptr);
184  }
185  HeartbeatMonitor::~HeartbeatMonitor()
186  {
187  std::lock_guard<std::mutex> guard {mtx};
188  shutdown = true;
189  if (t.joinable())
190  {
191  t.join();
192  }
193  }
194  void HeartbeatMonitor::heartbeatTask()
195  {
196  while (!shutdown)
197  {
198  IceUtil::Time now;
199  {
200  // this stops all dtors of RemoteReferenceCounter
201  // -> if the ptr is not already in entriesToDelete,
202  // the object can't be deleted
203  std::lock_guard<std::mutex> guard {mtx};
204  now = IceUtil::Time::now();
205  while (!shutdown && !entries.empty() && entries.top().first <= now)
206  {
207  RemoteReferenceCounter* ptr;
208  std::tie(std::ignore, ptr) = entries.top();
209  entries.pop();
210  if (entriesToDelete.count(ptr))
211  {
212  continue;
213  }
214  try
215  {
216  // the remote may be dead!
217  entries.emplace(ptr->heartbeat(now), ptr);
218  }
219  catch (...)
220  {}
221  }
222  }
223  IceUtil::Time msToSleep = maximalSleepTime;
224  if (!entries.empty())
225  {
226  msToSleep = std::min(maximalSleepTime, entries.top().first - now);
227  }
228  std::this_thread::sleep_for(std::chrono::milliseconds {msToSleep.toMilliSeconds()});
229  }
230  }
231 
233  {
234  if (!shutdown.exchange(true))
235  {
236  if (thread.joinable())
237  {
238  thread.join();
239  }
240  }
241  }
242 
243  void RemoteReferenceCountControlBlockManager::manage()
244  {
245  while (!shutdown)
246  {
247  IceUtil::Time now;
248  {
249  std::lock_guard<std::mutex> guard {stateMutex};
250  now = IceUtil::Time::now();
251  //sweep pendingForActivation
252  {
253  auto newPendingForActivation = pendingForActivation;
254  for (const auto& pending : pendingForActivation)
255  {
256  if (pending->isCountingActivated())
257  {
258  rrccbs.emplace(pending->nextCheckTimePoint(), pending);
259  newPendingForActivation.erase(pending);
260  }
261  }
262  pendingForActivation = std::move(newPendingForActivation);
263  }
264  //sweep rrccbs
265  while (!shutdown && !rrccbs.empty() && rrccbs.top().first <= now)
266  {
268  std::tie(std::ignore, ptr) = rrccbs.top();
269  rrccbs.pop();
270  const auto newT = ptr->nextCheckTimePoint();
271  if (newT < now)
272  {
273  try
274  {
275  ptr->countReachedZero();
276  }
277  catch (...)
278  {
279  ARMARX_WARNING << " function countReachedZero threw an exception";
280  }
281  continue;
282  }
283  rrccbs.emplace(newT, std::move(ptr));
284  }
285  }
286  std::this_thread::sleep_for(std::chrono::milliseconds {period.toMilliSeconds()});
287  }
288  //exiting -> call all reach 0 + warn
289  ARMARX_CHECK_EXPRESSION(shutdown);
290  std::lock_guard<std::mutex> guard {stateMutex};
291  auto processRemovedEntry = [](const detail::RemoteReferenceCountControlBlockManagementInterfacePtr & ptr)
292  {
294  ARMARX_CHECK_EXPRESSION(ptr->getProxy());
295  ARMARX_WARNING << "REMOVING RemoteReferenceCount on shutdown!:\n"
296  << " counting activated : " << ptr->isCountingActivated() << "\n"
297  << " identity (cat/name): " << ptr->getProxy()->ice_getIdentity().category << " / " << ptr->getProxy()->ice_getIdentity().name << "\n"
298  << " type id : " << ptr->getProxy()->ice_id();
299  try
300  {
301  ptr->countReachedZero();
302  }
303  catch (...)
304  {}
305  };
306 
307  while (!rrccbs.empty())
308  {
310  std::tie(std::ignore, ptr) = rrccbs.top();
311  rrccbs.pop();
312  processRemovedEntry(ptr);
313  }
314  for (const auto& ptr : pendingForActivation)
315  {
316  processRemovedEntry(ptr);
317  }
318  pendingForActivation.clear();
319  }
320 
322  {
324  ARMARX_CHECK_EXPRESSION(ptr->getProxy());
325  std::lock_guard<std::mutex> guard {stateMutex};
326  ARMARX_CHECK_EXPRESSION(!shutdown);
327  if (!thread.joinable())
328  {
329  thread = std::thread {[this]{manage();}};
330  }
331  pendingForActivation.emplace(ptr);
332  }
333 }
334 
335 namespace armarx::detail
336 {
337  //RemoteReferenceCountControlBlockManagementInterface
339  : armarXManager {manager}, id {id}
340  {
341  ARMARX_CHECK_EXPRESSION(armarXManager);
342  const auto iceId = Ice::stringToIdentity("RRCB_" + IceUtil::generateUUID());
343  __setNoDelete(true);
344  selfProxy = armarXManager->getAdapter()->add(this, iceId);
345  __setNoDelete(false);
346  }
347 
349  {
350  if (!armarXManager)
351  {
352  ARMARX_FATAL << "armarXManager NULL\n(line " << __LINE__ << " in " << __FUNCTION__ << " in " << __FILE__ ")";
353  std::terminate(); //throwing an exception calls terminate anyways (the dtor is noexcept) -> call terminate directly";
354  }
355  if (!selfProxy)
356  {
357  ARMARX_FATAL << "selfProxy NULL\n(line " << __LINE__ << " in " << __FUNCTION__ << " in " << __FILE__ ")";
358  std::terminate(); //throwing an exception calls terminate anyways (the dtor is noexcept) -> call terminate directly";
359  }
360  try
361  {
362  //removing may fail if the adapter was deactivated in a different thread
363  armarXManager->getAdapter()->remove(selfProxy->ice_getIdentity());
364  }
365  catch (Ice::ObjectAdapterDeactivatedException&) {}
366  }
367 
369  {
371  ARMARX_CHECK_EXPRESSION(!countReachedZero_.exchange(true));
373  }
374 
375  //AbstractRemoteReferenceCountControlBlock
376  void AbstractRemoteReferenceCountControlBlock::addCounter(const std::string& counterId, const Ice::Current&)
377  {
378  std::lock_guard<std::mutex> guard {mtx};
379  if (counterIds.count(counterId))
380  {
381  ARMARX_WARNING << "an already existing counter id was added! " << VAROUT(counterId);
382  }
383  else
384  {
385  ARMARX_DEBUG << "adding counter id '" << counterId << "'. "
386  << "New number of counters: " << counterIds.size() + 1;
387  }
388  counterIds[counterId] = IceUtil::Time::now();
389  }
390  void AbstractRemoteReferenceCountControlBlock::heartbeat(const std::string& counterId, const Ice::Current&)
391  {
392  std::lock_guard<std::mutex> guard {mtx};
393  if (!counterIds.count(counterId))
394  {
395  ARMARX_WARNING << "heartbeat of nonexistent counter '" << counterId << "'. "
396  << "The counter was added.";
397  }
398  counterIds[counterId] = IceUtil::Time::now();
399  }
400  void AbstractRemoteReferenceCountControlBlock::removeCounter(const std::string& counterId, const Ice::Current&)
401  {
402  std::lock_guard<std::mutex> guard {mtx};
403  if (counterIds.count(counterId))
404  {
405  counterIds.erase(counterId);
406  ARMARX_DEBUG << "deleteing counter id '" << counterId << "'. "
407  << "Remaining number of counters: " << counterIds.size();
408  }
409  else
410  {
411  ARMARX_WARNING << "an non-existent counter id was deleted! " << VAROUT(counterId);
412  }
413  if (counterIds.empty())
414  {
415  lastTimeReachedZero = IceUtil::Time::now();
416  }
417  }
418 
420  IceUtil::Time deletionDelay, IceUtil::Time orphantDeletionDelay, long heartBeatMs)
422  deletionDelay {deletionDelay}, orphantDeletionDelay {orphantDeletionDelay}, heartBeatMs {heartBeatMs}
423  {
424  ARMARX_CHECK_GREATER(heartBeatMs, 0);
425  ARMARX_CHECK_GREATER(deletionDelay.toMicroSeconds(), 0);
426  ARMARX_CHECK_GREATER(orphantDeletionDelay.toMicroSeconds(), 0);
427  }
428  IceUtil::Time AbstractRemoteReferenceCountControlBlock::nextCheckTimePoint()
429  {
430  std::lock_guard<std::mutex> guard {mtx};
431  if (counterIds.empty())
432  {
433  return lastTimeReachedZero + deletionDelay;
434  }
435  else
436  {
438  for (const auto& entry : counterIds)
439  {
440  max = std::max(max, entry.second);
441  }
442  return max + orphantDeletionDelay;
443  }
444  }
446  {
447  ARMARX_DEBUG << "creating RemoteReferenceCounterBasePtr";
448  auto proxy = RemoteReferenceCountControlBlockInterfacePrx::checkedCast(selfProxy);
449  ARMARX_CHECK_NOT_NULL(proxy);
450  return new RemoteReferenceCounter {proxy, id, heartBeatMs};
451  }
452 
453  //AbstractSimpleRemoteReferenceCountControlBlock
454  void AbstractSimpleRemoteReferenceCountControlBlock::addCounter(const std::string& counterId, const Ice::Current&)
455  {
456  std::lock_guard<std::mutex> guard {mtx};
457  if (counterIds.count(counterId))
458  {
459  ARMARX_WARNING << "an already existing counter id was added! " << VAROUT(counterId);
460  }
461  else
462  {
463  counterIds.emplace(counterId);
464  ARMARX_DEBUG << "adding counter id '" << counterId << "'. "
465  << "New number of counters: " << counterIds.size();
466  }
467  }
468  void AbstractSimpleRemoteReferenceCountControlBlock::removeCounter(const std::string& counterId, const Ice::Current&)
469  {
470  std::lock_guard<std::mutex> guard {mtx};
471  if (counterIds.count(counterId))
472  {
473  counterIds.erase(counterId);
474  ARMARX_DEBUG << "deleteing counter id '" << counterId << "'. "
475  << "Remaining number of counters: " << counterIds.size();
476  }
477  else
478  {
479  ARMARX_WARNING << "an non-existent counter id was deleted! " << VAROUT(counterId);
480  }
481  if (counterIds.empty())
482  {
483  lastTimeReachedZero = IceUtil::Time::now();
484  }
485  }
486 
488  : RemoteReferenceCountControlBlockManagementInterface(manager, id), deletionDelay {deletionDelay}
489  {
490  ARMARX_CHECK_GREATER(deletionDelay.toMicroSeconds(), 0);
491  }
492 
494  {
495  ARMARX_DEBUG << "creating SimpleRemoteReferenceCounterBasePtr";
496  auto proxy = SimpleRemoteReferenceCountControlBlockInterfacePrx::checkedCast(selfProxy);
497  ARMARX_CHECK_NOT_NULL(proxy);
498  return new SimpleRemoteReferenceCounter {proxy, id};
499  }
500  IceUtil::Time AbstractSimpleRemoteReferenceCountControlBlock::nextCheckTimePoint()
501  {
502  std::lock_guard<std::mutex> guard {mtx};
503  if (counterIds.empty())
504  {
505  return lastTimeReachedZero + deletionDelay;
506  }
507  return IceUtil::Time::now() + deletionDelay;
508  }
509 }
510 
511 namespace armarx::ObjectFactories
512 {
514  {
515  public:
517  {
518  ObjectFactoryMap map;
519  add<armarx::RemoteReferenceCounterBase, armarx::RemoteReferenceCounter>(map);
520  add<armarx::SimpleRemoteReferenceCounterBase, armarx::SimpleRemoteReferenceCounter>(map);
521  return map;
522  }
523  };
526 }
527 
528 namespace armarx
529 {
532 }
armarx::detail::AbstractRemoteReferenceCountControlBlock::AbstractRemoteReferenceCountControlBlock
AbstractRemoteReferenceCountControlBlock(const ArmarXManagerPtr &manager, const std::string &id, IceUtil::Time deletionDelay, IceUtil::Time orphantDeletionDelay, long heartBeatMs)
Definition: RemoteReferenceCount.cpp:419
armarx::detail::AbstractRemoteReferenceCountControlBlock::removeCounter
void removeCounter(const std::string &counterId, const Ice::Current &=Ice::emptyCurrent) final override
Definition: RemoteReferenceCount.cpp:400
armarx::SimpleRemoteReferenceCounter::~SimpleRemoteReferenceCounter
~SimpleRemoteReferenceCounter() override
Definition: RemoteReferenceCount.cpp:138
armarx::RemoteReferenceCounter::~RemoteReferenceCounter
~RemoteReferenceCounter() override
Definition: RemoteReferenceCount.cpp:94
ArmarXManager.h
armarx::RemoteReferenceCountControlBlockManager::DefaultOrphantDeletionDelayMs
static const Ice::Long DefaultOrphantDeletionDelayMs
Definition: RemoteReferenceCount.h:259
armarx::SimpleRemoteReferenceCounter::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: RemoteReferenceCount.cpp:154
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::RemoteReferenceCountControlBlockManager::DefaultDeletionDelayMs
static const Ice::Long DefaultDeletionDelayMs
Definition: RemoteReferenceCount.h:258
armarx::detail::AbstractSimpleRemoteReferenceCountControlBlock::getReferenceCounter
SimpleRemoteReferenceCounterBasePtr getReferenceCounter()
Definition: RemoteReferenceCount.cpp:493
armarx::ObjectFactories::RemoteReferenceCounterObjectFactories
Definition: RemoteReferenceCount.cpp:513
ARMARX_CHECK_GREATER
#define ARMARX_CHECK_GREATER(lhs, rhs)
This macro evaluates whether lhs is greater (>) than rhs and if it turns out to be false it will thro...
Definition: ExpressionException.h:116
armarx::RemoteReferenceCounter::ice_postUnmarshal
void ice_postUnmarshal() override
Definition: RemoteReferenceCount.cpp:111
armarx::max
std::vector< T > max(const std::vector< T > &v1, const std::vector< T > &v2)
Definition: VectorHelpers.h:267
armarx::SimpleRemoteReferenceCounter::SimpleRemoteReferenceCounter
SimpleRemoteReferenceCounter(const SimpleRemoteReferenceCounter &other)
Definition: RemoteReferenceCount.cpp:136
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::isCountingActivated
bool isCountingActivated() const
Definition: RemoteReferenceCount.h:59
FactoryCollectionBase.h
armarx::ObjectFactoryMap
std::map< std::string, Ice::ValueFactoryPtr > ObjectFactoryMap
Definition: FactoryCollectionBase.h:61
armarx::RemoteReferenceCountControlBlockManager::stop
void stop()
Definition: RemoteReferenceCount.cpp:232
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::onCountReachedZero
virtual void onCountReachedZero()=0
armarx::detail::AbstractSimpleRemoteReferenceCountControlBlock::addCounter
void addCounter(const std::string &counterId, const Ice::Current &) final override
Definition: RemoteReferenceCount.cpp:454
armarx::ObjectFactories::RemoteReferenceCounterObjectFactoriesVar
const FactoryCollectionBaseCleanUp RemoteReferenceCounterObjectFactoriesVar
Definition: RemoteReferenceCount.cpp:524
armarx::detail::AbstractRemoteReferenceCountControlBlock::addCounter
void addCounter(const std::string &counterId, const Ice::Current &=Ice::emptyCurrent) final override
Definition: RemoteReferenceCount.cpp:376
armarx::detail::AbstractSimpleRemoteReferenceCountControlBlock::removeCounter
void removeCounter(const std::string &counterId, const Ice::Current &) final override
Definition: RemoteReferenceCount.cpp:468
ARMARX_FATAL
#define ARMARX_FATAL
Definition: Logging.h:192
RemoteReferenceCount.h
armarx::ObjectFactories::RemoteReferenceCounterObjectFactories::getFactories
ObjectFactoryMap getFactories() override
Definition: RemoteReferenceCount.cpp:516
armarx::detail::AbstractSimpleRemoteReferenceCountControlBlock::AbstractSimpleRemoteReferenceCountControlBlock
AbstractSimpleRemoteReferenceCountControlBlock(const ArmarXManagerPtr &manager, const std::string &id, IceUtil::Time deletionDelay)
Definition: RemoteReferenceCount.cpp:487
armarx::HeartbeatMonitor::Remove
static void Remove(RemoteReferenceCounter *ptr)
Definition: RemoteReferenceCount.cpp:51
armarx::detail::RemoteReferenceCountControlBlockManagementInterfacePtr
IceUtil::Handle< detail::RemoteReferenceCountControlBlockManagementInterface > RemoteReferenceCountControlBlockManagementInterfacePtr
Definition: RemoteReferenceCount.h:101
armarx::FactoryCollectionBase::addToPreregistration
static FactoryCollectionBaseCleanUp addToPreregistration(FactoryCollectionBasePtr factoryCollection)
Definition: FactoryCollectionBase.cpp:41
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:177
armarx::FactoryCollectionBase
Definition: FactoryCollectionBase.h:63
armarx::RemoteReferenceCountControlBlockManager::add
void add(detail::RemoteReferenceCountControlBlockManagementInterfacePtr ptr)
Definition: RemoteReferenceCount.cpp:321
boost::process::posix::terminate
void terminate(const Process &p)
Definition: terminate.hpp:20
armarx::RemoteReferenceCounter::RemoteReferenceCounter
RemoteReferenceCounter(const RemoteReferenceCountControlBlockInterfacePrx &prx, const std::string &id, Ice::Long heartBeatMs)
Definition: RemoteReferenceCount.cpp:87
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::countReachedZero
void countReachedZero()
Definition: RemoteReferenceCount.cpp:368
armarx::HeartbeatMonitor::Add
static void Add(RemoteReferenceCounter *ptr)
Definition: RemoteReferenceCount.cpp:47
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::RemoteReferenceCountControlBlockManagementInterface
RemoteReferenceCountControlBlockManagementInterface(const ArmarXManagerPtr &manager, const std::string &id)
Definition: RemoteReferenceCount.cpp:338
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::SimpleRemoteReferenceCounter::SimpleRemoteReferenceCounter
SimpleRemoteReferenceCounter()=default
max
T max(T t1, T t2)
Definition: gdiam.h:48
armarx::detail
Definition: ApplicationNetworkStats.cpp:34
armarx::detail::RemoteReferenceCountControlBlockManagementInterface
Definition: RemoteReferenceCount.h:51
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::id
const std::string id
Definition: RemoteReferenceCount.h:95
armarx::detail::AbstractRemoteReferenceCountControlBlock::getReferenceCounter
RemoteReferenceCounterBasePtr getReferenceCounter()
Definition: RemoteReferenceCount.cpp:445
armarx::detail::AbstractRemoteReferenceCountControlBlock::heartbeat
void heartbeat(const std::string &counterId, const Ice::Current &=Ice::emptyCurrent) final override
Definition: RemoteReferenceCount.cpp:390
ExpressionException.h
armarx::RemoteReferenceCounter
Definition: RemoteReferenceCount.cpp:83
armarx::SimpleRemoteReferenceCounter::copy
SimpleRemoteReferenceCounterBasePtr copy(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: RemoteReferenceCount.cpp:146
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::lastTimeReachedZero
IceUtil::Time lastTimeReachedZero
Definition: RemoteReferenceCount.h:93
VAROUT
#define VAROUT(x)
Definition: StringHelpers.h:182
IceUtil::Handle
Definition: forward_declarations.h:29
armarx::SimpleRemoteReferenceCounter
Definition: RemoteReferenceCount.cpp:128
armarx::HeartbeatMonitor
Definition: RemoteReferenceCount.cpp:44
armarx::SimpleRemoteReferenceCounter::SimpleRemoteReferenceCounter
SimpleRemoteReferenceCounter(const SimpleRemoteReferenceCountControlBlockInterfacePrx &prx, const std::string &id)
Definition: RemoteReferenceCount.cpp:132
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::selfProxy
Ice::ObjectPrx selfProxy
Definition: RemoteReferenceCount.h:90
armarx::RemoteReferenceCounter::RemoteReferenceCounter
RemoteReferenceCounter(const RemoteReferenceCounter &other)
Definition: RemoteReferenceCount.cpp:92
armarx::RemoteReferenceCounter::heartbeat
IceUtil::Time heartbeat(IceUtil::Time now)
Definition: RemoteReferenceCount.cpp:116
armarx::RemoteReferenceCounter::copy
RemoteReferenceCounterBasePtr copy(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: RemoteReferenceCount.cpp:103
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::armarXManager
ArmarXManagerPtr armarXManager
Definition: RemoteReferenceCount.h:89
armarx::ObjectFactories
Definition: CoreObjectFactories.h:54
min
T min(T t1, T t2)
Definition: gdiam.h:42
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::FactoryCollectionBaseCleanUp
Definition: FactoryCollectionBase.h:38
armarx::RemoteReferenceCounter::RemoteReferenceCounter
RemoteReferenceCounter()=default
armarx::RemoteReferenceCounter::getId
std::string getId(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: RemoteReferenceCount.cpp:107
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::mtx
std::mutex mtx
Definition: RemoteReferenceCount.h:92
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SimpleRemoteReferenceCounter::getId
std::string getId(const Ice::Current &=Ice::emptyCurrent) const final override
Definition: RemoteReferenceCount.cpp:150
armarx::detail::RemoteReferenceCountControlBlockManagementInterface::~RemoteReferenceCountControlBlockManagementInterface
~RemoteReferenceCountControlBlockManagementInterface() override
Definition: RemoteReferenceCount.cpp:348