Package org.apache.thrift.transport

Examples of org.apache.thrift.transport.TSocket


        "hadoop041.sf2p.facebook.com"
        };
    int port = 9160;
           
    //TNonBlockingSocket socket = new TNonBlockingSocket(hosts[roundRobin_], port);
    TSocket socket = new TSocket("hadoop071.sf2p.facebook.com", port);
    roundRobin_ = (roundRobin_+1)%4;
    if(transport_ != null)
      transport_.close();
    transport_ = socket;
View Full Code Here


            if (socket != null && socket.isOpen())
                return;

            // create connection using thrift
            String location = getLocation();
            socket = new TSocket(location, ConfigHelper.getInputRpcPort(conf));
            TBinaryProtocol binaryProtocol = new TBinaryProtocol(new TFramedTransport(socket));
            client = new Cassandra.Client(binaryProtocol);
            socket.open();

            // log in
View Full Code Here

            return cfs != null && cfs.contains(cfName);
        }

        private static Cassandra.Client createThriftClient(String host, int port) throws TTransportException
        {
            TSocket socket = new TSocket(host, port);
            TTransport trans = new TFramedTransport(socket);
            trans.open();
            TProtocol protocol = new org.apache.thrift.protocol.TBinaryProtocol(trans);
            return new Cassandra.Client(protocol);
        }
View Full Code Here

            return cfs != null && cfs.contains(cfName);
        }

        private static Cassandra.Client createThriftClient(String host, int port) throws TTransportException
        {
            TSocket socket = new TSocket(host, port);
            TTransport trans = new TFramedTransport(socket);
            trans.open();
            TProtocol protocol = new TBinaryProtocol(trans);
            return new Cassandra.Client(protocol);
        }
View Full Code Here

    private static CliClient cliClient_;

    // Establish a thrift connection to cassandra instance
    public static void connect(String server, int port)
    {
        TSocket socket = new TSocket(server, port);

        if (transport_ != null)
            transport_.close();

        if (css_.framed) {
View Full Code Here

     * @param server - hostname or IP of the server
     * @param port   - Thrift port number
     */
    public static void connect(String server, int port)
    {
        TSocket socket = new TSocket(server, port);

        if (transport != null)
            transport.close();

        transport = sessionState.transportFactory.getTransport(socket);
View Full Code Here

    public CassandraClient getClient(boolean setKeyspace)
    {
        // random node selection for fake load balancing
        String currentNode = nodes[Stress.randomizer.nextInt(nodes.length)];

        TSocket socket = new TSocket(currentNode, port);
        TTransport transport = transportFactory.getTransport(socket);
        CassandraClient client = new CassandraClient(new TBinaryProtocol(transport));

        try
        {
View Full Code Here

            if (socket != null && socket.isOpen())
                return;

            // create connection using thrift
            String location = getLocation();
            socket = new TSocket(location, ConfigHelper.getRpcPort(conf));
            TBinaryProtocol binaryProtocol = new TBinaryProtocol(new TFramedTransport(socket));
            client = new Cassandra.Client(binaryProtocol);
            socket.open();

            // log in
View Full Code Here

  public TestProxyClient(String host, int port) throws TTransportException {
    this(host, port, new TCompactProtocol.Factory());
  }
 
  public TestProxyClient(String host, int port, TProtocolFactory protoFactory) throws TTransportException {
    final TSocket socket = new TSocket(host, port);
    socket.setTimeout(600000);
    transport = new TFramedTransport(socket);
    final TProtocol protocol = protoFactory.getProtocol(transport);
    proxy = new AccumuloProxy.Client(protocol);
    transport.open();
  }
View Full Code Here

      String[] hostAddr = destination.split(":", 2);
      log.debug("Connecting to " + hostAddr[0] + ":" + hostAddr[1]);
      InetSocketAddress addr = new InetSocketAddress(hostAddr[0], Integer.parseInt(hostAddr[1]));
      Socket sock = new Socket();
      sock.connect(addr);
      TTransport transport = new TSocket(sock);
      TProtocol prot = new TBinaryProtocol(transport);
      return new Client(prot);
    } catch (Exception ex) {
      log.error(ex, ex);
      return null;
View Full Code Here

TOP

Related Classes of org.apache.thrift.transport.TSocket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.