![]() |
Vault
4.1
|
VManagementInterface defines the interface for a class you can provide that will be notified as threads come and go, so that you can keep track of listeners, start them, stop them, kill them, etc. More...
#include <vmanagementinterface.h>
Public Member Functions | |
| VManagementInterface () | |
| Constructs the interface object. | |
| virtual | ~VManagementInterface () |
| Destructor. | |
| virtual void | threadStarting (VThread *thread)=0 |
| Notifies the interface of a new thread thread whose run() is about to be invoked. | |
| virtual void | threadEnded (VThread *thread)=0 |
| Notifies the interface of a thread whose run() has just reached its end. | |
| virtual void | listenerStarting (VListenerThread *listener)=0 |
| Notifies the interface of a new listener thread whose runListening() is underway and is about to start listening. | |
| virtual void | listenerListening (VListenerThread *listener)=0 |
| Notifies the interface that a listener thread has called listen() so that it is listening for connections. | |
| virtual void | listenerFailed (VListenerThread *listener, const VString &message)=0 |
| Notifies the interface of a listener thread whose runListening() has failed. | |
| virtual void | listenerEnded (VListenerThread *listener)=0 |
| Notifies the interface of a listener thread whose runListening() has just reached its end. | |
VManagementInterface defines the interface for a class you can provide that will be notified as threads come and go, so that you can keep track of listeners, start them, stop them, kill them, etc.
You might use this to create a management connection listener that processes messages for managing the server with the above operations.
You pass an instance of VManagementInterface, or NULL, to each VThread that is created by your factories. This specifies the management interface object that is notified of that thread's lifecycle.
Definition at line 27 of file vmanagementinterface.h.
| virtual void VManagementInterface::threadStarting | ( | VThread * | thread | ) | [pure virtual] |
Notifies the interface of a new thread thread whose run() is about to be invoked.
The concrete class might typically add the thread pointer to a vector. The thread pointer is guaranteed to be valid until the interface is notified of threadEnded().
| thread | the thread to add to the interface's list |
| virtual void VManagementInterface::threadEnded | ( | VThread * | thread | ) | [pure virtual] |
Notifies the interface of a thread whose run() has just reached its end.
The concrete class might typically remove the thread pointer from a vector. Upon return from this notification, the interface must not reference the thread object if the thread's mDeleteAtEnd property is set to true, because in that case the threadMain function will immediately delete the thread object.
| thread | the thread to remove from the list |
| virtual void VManagementInterface::listenerStarting | ( | VListenerThread * | listener | ) | [pure virtual] |
Notifies the interface of a new listener thread whose runListening() is underway and is about to start listening.
The concrete class might typically add the thread pointer to a vector. The thread pointer is guaranteed to be valid until the interface is notified of listenerEnded(). Important note: the management interface will also receive a threadStarting() notification for this listener thread, because it is also just a thread; that notification will occur before the listenerStarting() notification.
| listener | the listener thread that is running |
| virtual void VManagementInterface::listenerListening | ( | VListenerThread * | listener | ) | [pure virtual] |
Notifies the interface that a listener thread has called listen() so that it is listening for connections.
An example use might be a loopback connection testing class, which needs to wait until the listener is actually listening before it can open a connection to the loopback server socket. The thread pointer is guaranteed to be valid until the interface is notified of listenerEnded().
| listener | the listener thread that is listening |
| virtual void VManagementInterface::listenerFailed | ( | VListenerThread * | listener, |
| const VString & | message | ||
| ) | [pure virtual] |
Notifies the interface of a listener thread whose runListening() has failed.
This is typically due to the port being in use, and indicates the inability to listen on the port. The concrete class might typically decide to stop the listener thread (so it doesn't keep trying to listen) and shut down the server (since this may indicate a failure to start up properly). This notification will occur between calls to listenerStarting() and listenerEnded(). Note that listenerEnded() will be definitely called after listenerFailed().
| listener | the listener thread that failed |
| message | error message describing the failure |
| virtual void VManagementInterface::listenerEnded | ( | VListenerThread * | listener | ) | [pure virtual] |
Notifies the interface of a listener thread whose runListening() has just reached its end.
The concrete class might typically remove the thread pointer from a vector. Upon return from this notification, the interface must not reference the thread object if the thread's mDeleteAtEnd property is set to true, because in that case the threadMain function will immediately delete the thread object. Important note: the management interface will also receive a threadEnded() notification for this listener thread, because it is also just a thread; that notification will occur after the listenerEnded() notification.
| listener | the listener thread that has ended |