Qore ConnectionProvider Module Reference
1.7
|
Class for monitoring connection supporting the polling API. More...
Public Member Methods | |
add (AbstractConnection conn) | |
Adds a connection to be monitored. More... | |
addOrUpdate (AbstractConnection conn) | |
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 | 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. | |
setLogger (Logger logger) | |
Sets the logger. | |
start () | |
Starts monitoring. More... | |
stop () | |
Stops monitoring. | |
Private Member Methods | |
Queue | cmdq () |
I/O thread command queue. | |
Counter | cnt () |
I/O thread counter. | |
handlePingFailed (string name, hash< ExceptionInfo > ex) | |
Handles a failed ping. | |
handlePingSuccess (string name) | |
Handles a successful ping. | |
handlePingTimeout (string name) | |
Handles a poll timeout. | |
Mutex | m () |
Lock for atomic actions. | |
restartPing (string name, *bool force_restart) | |
Restarts a ping operation. | |
Private Attributes | |
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_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. | |
Private:Internal Attributes | |
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.
ConnectionProvider::PollingConnectionMonitor::add | ( | AbstractConnection | conn | ) |
Adds a connection to be monitored.
conn | the connection to be monitored; must support the connection polling API |
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 |
ConnectionProvider::PollingConnectionMonitor::addOrUpdate | ( | AbstractConnection | conn | ) |
Adds or updates an existing connection that is already being monitored.
conn | the connection to be monitored; must support the connection polling API |
MONITOR-CONNECTION-ERROR | the connection does not support the connection polling API |
bool ConnectionProvider::PollingConnectionMonitor::removeConnection | ( | string | name | ) |
Removes the given connection.
name | the connection to be removed |
ConnectionProvider::PollingConnectionMonitor::removeConnectionEx | ( | string | name | ) |
Removes the given connection.
name | the connection to be removed |
MONITOR-REMOVE-ERROR | thrown if the named connection is not being monitored |
ConnectionProvider::PollingConnectionMonitor::start | ( | ) |
Starts monitoring.
MONITOR-START-ERROR | if the I/O thread is already running |