Examples of TProtocol


Examples of org.apache.thrift.protocol.TProtocol

        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

Examples of org.apache.thrift.protocol.TProtocol

  private void openTransport() throws SQLException {
    transport = isHttpTransportMode() ?
        createHttpTransport() :
          createBinaryTransport();
    TProtocol protocol = new TBinaryProtocol(transport);
    client = new TCLIService.Client(protocol);
    try {
      transport.open();
    } catch (TTransportException e) {
      throw new SQLException("Could not open connection to "
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

         * invocation of the factory method, no need to specifically call open()
         */
        transport = TSSLTransportFactory.getClientSocket("localhost", 9091, 0, params);
      }

      TProtocol protocol = new  TBinaryProtocol(transport);
      Calculator.Client client = new Calculator.Client(protocol);

      perform(client);

      transport.close();
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

    public void init() {
        try {
            final TSocket socket = new TSocket(host, port);
            socket.setTimeout(1000);
            transport = new TFramedTransport(socket);
            final TProtocol protocol = new TBinaryProtocol(transport);
            scribe = new scribe.Client(protocol);
            transport.open();
        } catch (TException e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

        }
    }

    public byte[] toBytes(T object) {
        MemoryBuffer buffer = new MemoryBuffer();
        TProtocol protocol = createThriftProtocol(buffer);
        try {
            object.write(protocol);
        } catch(TException e) {
            throw new SerializationException(e);
        }
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

        try {
            buffer.write(bytes);
        } catch(TTransportException e) {
            throw new SerializationException(e);
        }
        TProtocol protocol = createThriftProtocol(buffer);

        T msg = null;
        try {
            msg = messageClass.newInstance();
            msg.read(protocol);
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

        }
        catch (Exception e)
        {
            throw new TTransportException("Failed to open a transport to " + location + ":" + port + ".", e);
        }
        TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true);
        Cassandra.Client client = new Cassandra.Client(binaryProtocol);

        // log in
        client.set_keyspace(ConfigHelper.getInputKeyspace(conf));
        if (ConfigHelper.getInputKeyspaceUserName(conf) != null)
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

        private static Cassandra.Client createThriftClient(String host, int port, String user, String passwd) throws Exception
        {
            TSocket socket = new TSocket(host, port);
            TTransport trans = new TFramedTransport(socket);
            trans.open();
            TProtocol protocol = new TBinaryProtocol(trans);
            Cassandra.Client client = new Cassandra.Client(protocol);
            if (user != null && passwd != null)
            {
                Map<String, String> credentials = new HashMap<String, String>();
                credentials.put(IAuthenticator.USERNAME_KEY, user);
View Full Code Here

Examples of org.apache.thrift.protocol.TProtocol

 
  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

Examples of org.apache.thrift.protocol.TProtocol

        try {
            Object results = null;
            TChannelBufferOutputTransport outputTransport = new TChannelBufferOutputTransport();
            ChannelBuffer requestBuffer = outputTransport.getOutputBuffer();
            TProtocol outputProtocol = protocolFactory.getOutputProtocolFactory().getProtocol(outputTransport);

            // write request
            writeArguments(outputProtocol, sequenceId, args);

            if (!this.oneway) {
                ChannelBuffer responseBuffer;

                responseBuffer = SyncClientHelpers.sendSynchronousTwoWayMessage(channel, requestBuffer);

                TTransport inputTransport = new TChannelBufferInputTransport(responseBuffer);
                TProtocol inputProtocol = protocolFactory.getInputProtocolFactory().getProtocol(inputTransport);
                waitForResponse(inputProtocol, sequenceId);

                // read results
                results = readResponse(inputProtocol);
            } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.