Overview

Packages

  • None
  • thrift
    • transport

Classes

  • TBufferedTransport
  • TFramedTransport
  • THttpClient
  • TMemoryBuffer
  • TNullTransport
  • TPhpStream
  • TSocket
  • TSocketPool
  • TTransport
  • Overview
  • Package
  • Class
  • Tree

Class TSocketPool

Sockets implementation of the TTransport interface that allows connection to a pool of servers.

TTransport
Extended by TSocket
Extended by TSocketPool
Package: thrift\transport
Author: Mark Slee mcslee@facebook.com
Located at Horde/Thrift/thrift_root/transport/TSocketPool.php
Methods summary
public
# __construct( array $hosts = array('localhost'), mixed $ports = array(9090), boolean $persist = FALSE, mixed $debugHandler = null )

Socket pool constructor

Socket pool constructor

Parameters

$hosts
List of remote hostnames
$ports
Array of remote ports, or a single common port
$persist
Whether to use a persistent socket
$debugHandler
Function for error logging

Overrides

TSocket::__construct()
public
# addServer( string $host, integer $port )

Add a server to the pool

Add a server to the pool

This function does not prevent you from adding a duplicate server entry.

Parameters

$host
hostname or IP
$port
port
public
# setNumRetries( integer $numRetries )

Sets how many time to keep retrying a host in the connect function.

Sets how many time to keep retrying a host in the connect function.

Parameters

$numRetries
public
# setRetryInterval( integer $retryInterval )

Sets how long to wait until retrying a host if it was marked down

Sets how long to wait until retrying a host if it was marked down

Parameters

$retryInterval
$numRetries
public
# setMaxConsecutiveFailures( integer $maxConsecutiveFailures )

Sets how many time to keep retrying a host before marking it as down.

Sets how many time to keep retrying a host before marking it as down.

Parameters

$maxConsecutiveFailures
$numRetries
public
# setRandomize( boolean $randomize )

Turns randomization in connect order on or off.

Turns randomization in connect order on or off.

Parameters

$randomize
public
# setAlwaysTryLast( boolean $alwaysTryLast )

Whether to always try the last server.

Whether to always try the last server.

Parameters

$alwaysTryLast
public
# open( )

Connects the socket by iterating through all the servers in the pool and trying to find one that works.

Connects the socket by iterating through all the servers in the pool and trying to find one that works.

Throws

TTransportException
if cannot open

Overrides

TSocket::open()
Methods inherited from TSocket
close(), flush(), getHost(), getPort(), isOpen(), read(), readAll(), setDebug(), setRecvTimeout(), setSendTimeout(), write()
API documentation generated by ApiGen