![]() |
VR-Exchange 2.2 API Documentation
|
A DtQueueManager is responsible for creating and deleting all Shared memory Queues used by the portal. More...
Public Types | |
| typedef void(* | MessageCbFcn )(const DtPortalMessage &message, void *usr) |
Public Member Functions | |
| DtQueueManager (DtU32 numberOfBucketsInQueue, DtU32 payloadSizePerBucket, int port, DtU16 brokerId, const DtString &objectQueueName, const DtString &interactionQueueName, const DtString &controlQueueName) | |
| The Default CTOR to create a DtQueueManager. | |
| virtual | ~DtQueueManager () |
| Destructor. | |
| virtual void | send (DtPortalControlMessage &message) |
| virtual void | tick () |
| This class must be periodically ticked, no messages are read however, the queues are just drained. | |
| virtual void | requestBrokerShutdown () |
| Sends out a message asking all brokers to exit. | |
| virtual void | requestBrokerRestart (bool shouldMapMessagesOneToOne) |
| Sends out a message asking all running brokers to restart. | |
| virtual int | connectedBrokerCount () |
| Returns the number of known connected brokers. | |
| virtual void | pruneBrokerSocketMap () |
| This is called after a requestBrokerShutdown() call to prune dead brokers from the internal counter. | |
Message Queue Accessors | |
The following functions allow access to the individual message queues | |
| virtual DtSubscribableMessageQueue * | getControlMessageQueue () |
| virtual DtSubscribableMessageQueue * | getInteractionMessageQueue () |
| virtual DtSubscribableMessageQueue * | getObjectMessageQueue () |
Static Public Member Functions | |
| static DtQueueManager * | create (DtU32 numberOfBucketsInQueue, DtU32 payloadSizePerBucket, int port, DtU16 theBrokerId, const DtString &objectQueueName, const DtString &interactionQueueName, const DtString &controlQueueName) |
| A static function to create a Queue Manager. | |
Protected Types | |
| typedef std::map< int, DtInetTcpSocket * > | BrokerSocketMap |
| typedef std::map < DtInetTcpSocket *, int > | UnknownSocketMap |
Protected Member Functions | |
| virtual void | addSocket (DtInetTcpSocket *sock) |
| adds a socket to the unknown list | |
| virtual void | removeSocket (DtInetTcpSocket *sock) |
| removes knowledge of a socket cleanly | |
| virtual void | removeUnknownSocket (DtInetTcpSocket *sock) |
| Removes socket from unknown list. | |
| virtual void | processUnknownSockets () |
| tries to move sockets from the unknown list to the known list, by attempting to read the broker Id from the socket | |
| virtual void | testKnownSockets () |
| tests if the known sockets are still connected. | |
| void | drainSockets () |
| Drains all known sockets so that we don't have memory leaks, or sockets that fill up. | |
| virtual DtU8 | getUnusedBrokerID () |
Static Protected Member Functions | |
| static bool | addSocketCb (DtInetSocket *sock, void *usr) |
| static bool | removeSocketCb (DtInetSocket *sock, void *usr) |
Protected Attributes | |
| const DtU16 | theBrokerId |
| DtU32 | myControlSerialNumber |
| int | myTickCountForSocketTest |
| int | myTicksBeforeSocketTest |
| DtPortalMessageFactory | myMessageFactory |
| DtMemoryManager | myMemoryManager |
| DtSubscribableMessageQueue * | myControlMessageQueue |
| DtSubscribableMessageQueue * | myInteractionMessageQueue |
| DtSubscribableMessageQueue * | myObjectMessageQueue |
| DtInetSocketMgr * | myTcpSocketManager |
| DtClock | myClock |
| DtTime | myLastHeartbeatTime |
| BrokerSocketMap | myBrokerSocketMap |
| UnknownSocketMap | myUnknownBrokerSocketList |
Private Member Functions | |
| DtQueueManager (const DtQueueManager &other) | |
| Copy Ctor Not implemented – Class Not Copyable. | |
| DtQueueManager & | operator= (const DtQueueManager &other) |
| Assignment Operator Not implemented – Class Not Copyable. | |
A DtQueueManager is responsible for creating and deleting all Shared memory Queues used by the portal.
The portal must run one instance of the DtQueueManager. This class is responsible for creating and initializing all shared memory message queues used by the MAK Portal. When the instance is destroyed it will send a message to shutdown all brokers, and clean up the queues It also maintains a TCP Socket connection to all the brokers, which can monitor the Socket for a shutdown of the DtQueueManager, or vice versa
| typedef void(* MAKVrExchange::DtQueueManager::MessageCbFcn)(const DtPortalMessage &message, void *usr) |
|
protected |
|
protected |
| MAKVrExchange::DtQueueManager::DtQueueManager | ( | DtU32 | numberOfBucketsInQueue, |
| DtU32 | payloadSizePerBucket, | ||
| int | port, | ||
| DtU16 | brokerId, | ||
| const DtString & | objectQueueName, | ||
| const DtString & | interactionQueueName, | ||
| const DtString & | controlQueueName | ||
| ) |
The Default CTOR to create a DtQueueManager.
| port | - the port to listen for brokers on if set to 0 then no port will be opened. The portal will still work, but brokers will not be able to know if the portal has died |
|
virtual |
Destructor.
The destructor will send a message to shutdown all brokers, then pause for one second to give them time to exit. If the user wants a more orderly shutdown the functions requestBrokerShutdown(), connectedBrokerCount() and pruneBrokerSocketMap() should be used.
|
private |
Copy Ctor Not implemented – Class Not Copyable.
|
virtual |
|
virtual |
This class must be periodically ticked, no messages are read however, the queues are just drained.
|
virtual |
Sends out a message asking all brokers to exit.
Called from destructor but may also be called at anytime. Exit from this call does not mean that all brokers have shut down.
|
virtual |
Sends out a message asking all running brokers to restart.
Called when a portal setting changes that requires all brokers to restart in order to take change into effect. Takes argument about whether restarted broker should use one to one mapping
|
virtual |
Returns the number of known connected brokers.
This can be called after requestBrokerShutdown() to determine if any brokers have actualy shutdown. A count of zero indicates no connected brokers. The user must be sure all shutdown sockets are properly cleaned by calling pruneBrokerSocketMap() before calling connectedBrokerCount().
|
virtual |
This is called after a requestBrokerShutdown() call to prune dead brokers from the internal counter.
This must be called to insure connectedBrokerCount() is valid.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
static |
A static function to create a Queue Manager.
|
protectedvirtual |
adds a socket to the unknown list
|
protectedvirtual |
removes knowledge of a socket cleanly
|
protectedvirtual |
Removes socket from unknown list.
|
protectedvirtual |
tries to move sockets from the unknown list to the known list, by attempting to read the broker Id from the socket
|
protectedvirtual |
tests if the known sockets are still connected.
If not, it sends a message to the control queue of a broker failure
|
protected |
Drains all known sockets so that we don't have memory leaks, or sockets that fill up.
This discards all info, and should be called AFTER processUnknownSockets.
|
staticprotected |
|
staticprotected |
|
protectedvirtual |
|
private |
Assignment Operator Not implemented – Class Not Copyable.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |