|
The RemoteHandleControlBlock is the equivalent of the std::shared_ptr's contol_block for a remote handle. More...
#include <ArmarXCore/core/util/distributed/RemoteHandle/RemoteHandleControlBlock.h>
Classes | |
struct | ManagementData |
Returned by a call to RemoteHandleControlBlock::create. More... | |
Public Types | |
using | clock = std::chrono::steady_clock |
Public Member Functions | |
void | decrementUseCount (const Ice::Current &=Ice::emptyCurrent) override |
decrements the useCount. More... | |
void | forceDeletion () |
Call this when you want to force the deletion of the managed object. More... | |
ClientSideRemoteHandleControlBlockBasePtr | getClientSideRemoteHandleControlBlock (const Ice::Current &=Ice::emptyCurrent) override |
Ice::ObjectPrx | getManagedObjectProxy (const Ice::Current &=Ice::emptyCurrent) const override |
Ice::Long | getUseCount (const Ice::Current &=Ice::emptyCurrent) const override |
void | incrementUseCount (const Ice::Current &=Ice::emptyCurrent) override |
Increments the usecount. More... | |
Static Public Member Functions | |
template<class Deleter > | |
static ManagementData | create (ArmarXManagerPtr manager, Ice::ObjectPrx managedObjectPrx, Deleter deleter) |
Creates a new RemoteHandleControlBlock. More... | |
static int64_t | now () |
Friends | |
struct | SharedRemoteHandleState |
The RemoteHandleControlBlock is the equivalent of the std::shared_ptr's contol_block for a remote handle.
It does reference counting and object deletion.
This class is created on server side and a ClientSideRemoteHandleControlBlock is send to the client. Only create the class by calling RemoteHandleControlBlock::create.
A direct pointer can be used to force the deletion of the managed object. The deletion has to be done by a passed deleter (it may hold the only pointer to the managed object or execute code to remove the object from some structure). The deleter should do any unregistering for the managed object (e.g. remove the object from from an ice object adapter)
a object may leak if a connection error stops the message send when a handle is deleted (this stops the usecount from reaching zero). a object may be deleted with handles still alive if: 1) the object's deletion was forced 2) a scenario equivalent to this: pc A has the object and sends a handle to B pc B has now the only handle pc B now sends the handle to pc C and delets the handle before C deserialized the object (this could be done via a broadcast) The handle is deserialized after the deletion timeout set via property (default 3 sec) has passed. This scenario is possible but should not happen on a stable LAN if ice objects are not keept in a serialized form for a longer period.
(for more info: RemoteHandle tutorial)
Definition at line 102 of file RemoteHandleControlBlock.h.
using clock = std::chrono::steady_clock |
Definition at line 106 of file RemoteHandleControlBlock.h.
|
static |
Creates a new RemoteHandleControlBlock.
objectAdapter | The adapter used to register the RemoteHandleControlBlock to ice. |
managedObjectPrx | A Proxy to the managed object. |
deleter | A functor cleaning up the managed object. (has to delete it and unregister it) The Functor may have the only pointer keeping the managed object alive. |
Definition at line 215 of file RemoteHandleControlBlock.h.
|
override |
decrements the useCount.
DO NOT CALL IT. (except you have called incrementUseCount)
Definition at line 33 of file RemoteHandleControlBlock.cpp.
|
inline |
Call this when you want to force the deletion of the managed object.
It will be deleted ignoring the usecount. This may be used to ensure the deletion of all objects created by yout server when shutting down. This may be necessary if a client's decrementUseCount was lost by the network.
Definition at line 157 of file RemoteHandleControlBlock.h.
|
override |
Definition at line 43 of file RemoteHandleControlBlock.cpp.
|
inlineoverride |
Definition at line 200 of file RemoteHandleControlBlock.h.
|
inlineoverride |
Definition at line 195 of file RemoteHandleControlBlock.h.
|
inlineoverride |
Increments the usecount.
DO NOT CALL IT. (if you do, you are responsible to call decrementUseCount!)
Definition at line 190 of file RemoteHandleControlBlock.h.
|
inlinestatic |
|
friend |
Definition at line 187 of file RemoteHandleControlBlock.h.