Permalink
Browse files

changed persistence to default true + getclient fix

  • Loading branch information...
1 parent 9779159 commit e4d60e72c27ac615c050b0951e6ac7fe53f47cfb @mjpearson committed May 20, 2010
Showing with 9 additions and 3 deletions.
  1. +1 −1 config.php
  2. +3 −1 examples/address_supercolumn.php
  3. +5 −1 lib/Core.class.php
View
@@ -12,7 +12,7 @@
define('SCHEMA_PATH', dirname(__FILE__).'/schemas/');
define('THRIFT_PORT_DEFAULT', 9160);
define('DEFAULT_ROW_LIMIT', 10);
-define('PERSIST_CONNECTIONS', FALSE); // TSocket Persistence
+define('PERSIST_CONNECTIONS', TRUE); // TSocket Persistence
define('CASSANDRA_CONF_PATH', '/usr/local/src/apache-cassandra-0.6.1/conf/storage-conf.xml');
require_once dirname(__FILE__).'/lib/loader.php';
@@ -90,4 +90,6 @@ public function init() {
// Show the JSON for our CF with cloned data. This and the prior echo should match
echo '<pre>'.$addrsClone->toJSON(TRUE).'</pre>';
-?>
+
+PandraCore::disconnectAll();
+?>
View
@@ -320,6 +320,8 @@ static public function auto($host, $poolName = self::DEFAULT_POOL_NAME, $port =
new TBinaryProtocol($transport)));
$tokenMap = $client->get_string_property('token map');
+ $transport->close();
+ unset($transport); unset($client);
$tokens = json_decode($tokenMap);
foreach ($tokens as $token => $host) {
if (!self::connect($token, $host, $poolName)) {
@@ -427,7 +429,9 @@ static public function getClient($writeMode = FALSE) {
// check connection is open
try {
- self::$_socketPool[self::$_activePool][self::$_activeNode]['transport']->open();
+ if (!self::$_socketPool[self::$_activePool][self::$_activeNode]['transport']->isOpen()) {
+ self::$_socketPool[self::$_activePool][self::$_activeNode]['transport']->open();
+ }
return $conn;
} catch (TException $te) {

0 comments on commit e4d60e7

Please sign in to comment.