Class for monitoring connection supporting the polling API.  
 More...
#include <PollingConnectionMonitor.qc.dox.h>
 | 
|   | add (AbstractConnection conn, *hash< auto > other) | 
|   | Adds a connection to be monitored.  More...
  | 
|   | 
|   | addOrUpdate (AbstractConnection conn, *hash< auto > other) | 
|   | Adds or updates an existing connection that is already being monitored.  More...
  | 
|   | 
| 
  | constructor (*Logger logger) | 
|   | Creates the object. 
  | 
|   | 
| 
  | destructor () | 
|   | Stops the monitoring thread and destroys the object. 
  | 
|   | 
| 
bool  | getAutostart () | 
|   | Get autostart flag. 
  | 
|   | 
| bool  | removeConnection (string name) | 
|   | Removes the given connection.  More...
  | 
|   | 
|   | removeConnectionEx (string name) | 
|   | Removes the given connection.  More...
  | 
|   | 
| 
bool  | running () | 
|   | Returns True if the I/O thread is running. 
  | 
|   | 
| 
  | setAutostart (bool autostart=True) | 
|   | Set autostart flag. 
  | 
|   | 
| 
  | setLogger (Logger logger) | 
|   | Sets the logger. 
  | 
|   | 
|   | start () | 
|   | Starts monitoring.  More...
  | 
|   | 
| 
  | stop () | 
|   | Stops monitoring. 
  | 
|   | 
| 
  | stopClear () | 
|   | Stops monitoring and clears all connections. 
  | 
|   | 
 | 
| 
  | handlePingFailed (string name, date delta, hash< ExceptionInfo > ex) | 
|   | Handles a failed ping. 
  | 
|   | 
| 
  | handlePingSuccess (string name, date delta, *bool oldok) | 
|   | Handles a successful ping. 
  | 
|   | 
| 
  | handlePingTimeout (string name, date delta) | 
|   | Handles a poll timeout. 
  | 
|   | 
| 
  | handlePingTimeoutIntern (string name, date delta) | 
|   | Handles a ping timeout. 
  | 
|   | 
| 
Mutex  | m () | 
|   | Lock for atomic actions. 
  | 
|   | 
| 
  | restartPing (string name, *bool force_restart) | 
|   | Restarts a ping operation. 
  | 
|   | 
 | 
| 
bool  | autostart = True | 
|   | Autostart monitoring thread with first connection. 
  | 
|   | 
| 
hash< string, hash< PollInfo > >  | cache | 
|   | Connection cache; unique name -> connection object wrapper. 
  | 
|   | 
| 
const  | DefaultPingRepeat = 1m | 
|   | Default ping repeat duration. 
  | 
|   | 
| 
const  | DefaultPingTimeout = 30s | 
|   | Default ping timeout duration. 
  | 
|   | 
| 
const  | IO_ADD = "add" | 
|   | I/O thread command: add. 
  | 
|   | 
| 
const  | IO_QUIT = "quit" | 
|   | I/O thread command: quit. 
  | 
|   | 
| 
const  | IO_QUIT_REMOVE_ALL = "quit-remove-all" | 
|   | I/O thread command: quit and remove all connection. 
  | 
|   | 
| 
const  | IO_REMOVE = "remove" | 
|   | I/O thread command: remove. 
  | 
|   | 
| 
const  | IO_UPDATE = "update" | 
|   | I/O thread command: update. 
  | 
|   | 
| 
*Logger  | logger | 
|   | Logger. 
  | 
|   | 
| 
date  | ping_repeat = DefaultPingRepeat | 
|   | ping repeat duration 
  | 
|   | 
| 
date  | ping_timeout = DefaultPingTimeout | 
|   | ping timeout duration 
  | 
|   | 
| 
int  | tid | 
|   | I/O thread TID. 
  | 
|   | 
 | 
| 
Queue  | cmdq () | 
|   | I/O thread command queue. 
  | 
|   | 
| 
Counter  | mcnt () | 
|   | I/O thread counter. 
  | 
|   | 
 | 
| 
hash< SocketPollInfo >  | sem_info | 
|   | Semaphore descriptor info. 
  | 
|   | 
| 
ReadOnlyFile  | sem_read | 
|   | File to read in the I/O thread. 
  | 
|   | 
| 
File  | sem_write | 
|   | File to signal the I/O thread. 
  | 
|   | 
Class for monitoring connection supporting the polling API. 
- Since
 - ConnectionProvider 1.7 
 
 
◆ add()
      
        
          | ConnectionProvider::PollingConnectionMonitor::add  | 
          ( | 
          AbstractConnection  | 
          conn,  | 
        
        
           | 
           | 
          *hash< auto >  | 
          other  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Adds a connection to be monitored. 
- Parameters
 - 
  
    | conn | the connection to be monitored; must support the connection polling API  | 
    | other | a free-form hash to be stored alongside the connection | 
  
   
- Exceptions
 - 
  
    | MONITOR-CONNECTION-ERROR | the connection does not support the connection polling API  | 
    | MONITOR-ADD-ERROR | a different connection with this name is already being monitored  | 
  
   
 
 
◆ addOrUpdate()
      
        
          | ConnectionProvider::PollingConnectionMonitor::addOrUpdate  | 
          ( | 
          AbstractConnection  | 
          conn,  | 
        
        
           | 
           | 
          *hash< auto >  | 
          other  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Adds or updates an existing connection that is already being monitored. 
- Parameters
 - 
  
    | conn | the connection to be monitored; must support the connection polling API  | 
    | other | a free-form hash to be stored alongside the connection | 
  
   
- Exceptions
 - 
  
    | MONITOR-CONNECTION-ERROR | the connection does not support the connection polling API  | 
  
   
 
 
◆ removeConnection()
      
        
          | bool ConnectionProvider::PollingConnectionMonitor::removeConnection  | 
          ( | 
          string  | 
          name | ) | 
           | 
        
      
 
Removes the given connection. 
- Parameters
 - 
  
    | name | the connection to be removed | 
  
   
- Returns
 - True if the connection was removed, False if no such connection is being monitored
 
- Note
 - Stops the I/O thread if the last connection is removed and the autostart flag is enabled
 
- See also
 - removeConnectionEx() 
 
 
 
◆ removeConnectionEx()
      
        
          | ConnectionProvider::PollingConnectionMonitor::removeConnectionEx  | 
          ( | 
          string  | 
          name | ) | 
           | 
        
      
 
Removes the given connection. 
- Parameters
 - 
  
    | name | the connection to be removed | 
  
   
- Exceptions
 - 
  
    | MONITOR-REMOVE-ERROR | thrown if the named connection is not being monitored | 
  
   
- See also
 - removeConnection() 
 
 
 
◆ start()
      
        
          | ConnectionProvider::PollingConnectionMonitor::start  | 
          ( | 
           | ) | 
           | 
        
      
 
Starts monitoring. 
- Exceptions
 - 
  
    | MONITOR-START-ERROR | if the I/O thread is already running  |