class Poco::Net::TCPServerDispatcher

Overview

A helper class for TCPServer that dispatches connections to server connection threads. More…

#include <TCPServerDispatcher.h>

class TCPServerDispatcher: public Poco::Runnable
{
public:
    // construction

    TCPServerDispatcher(
        TCPServerConnectionFactory::Ptr pFactory,
        Poco::ThreadPool& threadPool,
        TCPServerParams::Ptr pParams
        );

    // methods

    void
    duplicate();

    void
    release();

    virtual
    void
    run();

    void
    enqueue(const StreamSocket& socket);

    void
    stop();

    int
    currentThreads() const;

    int
    maxThreads() const;

    int
    totalConnections() const;

    int
    currentConnections() const;

    int
    maxConcurrentConnections() const;

    int
    queuedConnections() const;

    int
    refusedConnections() const;

    const TCPServerParams&
    params() const;

protected:
    // methods

    void
    beginConnection();

    void
    endConnection();
};

Inherited Members

public:
    // methods

    virtual
    void
    run() = 0;

Detailed Documentation

A helper class for TCPServer that dispatches connections to server connection threads.

Construction

TCPServerDispatcher(
    TCPServerConnectionFactory::Ptr pFactory,
    Poco::ThreadPool& threadPool,
    TCPServerParams::Ptr pParams
    )

Creates the TCPServerDispatcher.

The dispatcher takes ownership of the TCPServerParams object. If no TCPServerParams object is supplied, the TCPServerDispatcher creates one.

Methods

void
duplicate()

Increments the object’s reference count.

void
release()

Decrements the object’s reference count and deletes the object if the count reaches zero.

virtual
void
run()

Runs the dispatcher.

void
enqueue(const StreamSocket& socket)

Queues the given socket connection.

void
stop()

Stops the dispatcher.

int
currentThreads() const

Returns the number of currently used threads.

int
maxThreads() const

Returns the maximum number of threads available.

int
totalConnections() const

Returns the total number of handled connections.

int
currentConnections() const

Returns the number of currently handled connections.

int
maxConcurrentConnections() const

Returns the maximum number of concurrently handled connections.

int
queuedConnections() const

Returns the number of queued connections.

int
refusedConnections() const

Returns the number of refused connections.

const TCPServerParams&
params() const

Returns a const reference to the TCPServerParam object.

void
beginConnection()

Updates the performance counters.

void
endConnection()

Updates the performance counters.