Beispiel #1
0
 def restart_thrift_clients(self, restart=True):
     if self.client_sync and restart:
         self.client_sync.close()
     self.client_sync = ThriftPooledClient(ms.Client, host="localhost",
       port=self.port, pool_size=1, async=False)
     if self.client_pool and restart:
         self.client_pool.close()
     self.client_pool = ThriftPooledClient(ms.Client, host="localhost",
       port=self.port, pool_size=5)
     if self.client_loop and restart:
         self.client_loop.close()
     self.client_loop = ThriftPooledClient(ms.Client, host="localhost",
       port=self.port, pool_size=1, async=True, network_timeout=7200000)
from hyphe_backend.memorystructure import MemoryStructure as ms
import time
from hyphe_backend.lib.thriftpool import ThriftPooledClient, ThriftSyncClient

from twisted.internet import reactor, threads

cl1 = ThriftSyncClient(iface_cls=ms.Client,
                       host='localhost',
                       port=9090,
                       retries=3,
                       framed_transport=True,
                       compact_protocol=False)
cl2 = ThriftPooledClient(iface_cls=ms.Client,
                         host='localhost',
                         port=9090,
                         pool_size=5,
                         retries=3,
                         framed_transport=True,
                         compact_protocol=False)
cl3 = ThriftPooledClient(iface_cls=ms.Client,
                         host='localhost',
                         port=9090,
                         pool_size=3,
                         retries=3,
                         framed_transport=True,
                         compact_protocol=False)
cl4 = ThriftPooledClient(iface_cls=ms.Client,
                         host='localhost',
                         port=9090,
                         pool_size=3,
                         retries=3,