Example usage for org.apache.thrift TServiceClient getInputProtocol

List of usage examples for org.apache.thrift TServiceClient getInputProtocol

Introduction

In this page you can find the example usage for org.apache.thrift TServiceClient getInputProtocol.

Prototype

public TProtocol getInputProtocol() 

Source Link

Document

Get the TProtocol being used as the input (read) protocol.

Usage

From source file:com.soapsnake.thrift.license.rpc.ThriftClientPoolFactory.java

public boolean validateObject(TServiceClient client) {
    TTransport pin = client.getInputProtocol().getTransport();
    return pin.isOpen();
}

From source file:ezbake.thrift.ThriftUtils.java

License:Apache License

public static void quietlyClose(TServiceClient client) {
    try {//  ww w  .  j a  v a 2s  . c o m
        client.getOutputProtocol().getTransport().close();
    } catch (Exception ignore) {
        //do nothing
    }
    try {
        client.getInputProtocol().getTransport().close();
    } catch (Exception ignore) {
        //do nothing
    }
}

From source file:ezbake.thrift.ThriftUtilsTest.java

License:Apache License

@Test
public void testGetClient() throws Exception {
    final HostAndPort hostandPort = HostAndPort.fromParts("localhost", portNum);
    final TServiceClient client = ThriftUtils.getClient(SampleService.Client.class, hostandPort,
            config.getProperties());/*from  ww  w  . ja  v  a  2  s .co  m*/
    try {
        assertNotNull(client);

    } finally {
        client.getInputProtocol().getTransport().close();
    }
}

From source file:org.apache.accumulo.core.client.impl.MasterClient.java

License:Apache License

public static void close(MasterClientService.Iface iface) {
    TServiceClient client = (TServiceClient) iface;
    if (client != null && client.getInputProtocol() != null
            && client.getInputProtocol().getTransport() != null) {
        ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {/*ww  w  .  j a  va 2s  .c  om*/
        log.debug("Attempt to close null connection to the master", new Exception());
    }
}

From source file:org.apache.accumulo.core.client.impl.ReplicationClient.java

License:Apache License

public static void close(ReplicationCoordinator.Iface iface) {
    TServiceClient client = (TServiceClient) iface;
    if (client != null && client.getInputProtocol() != null
            && client.getInputProtocol().getTransport() != null) {
        ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {/*from   www.ja  va 2s.c o  m*/
        log.debug("Attempt to close null connection to the remote system", new Exception());
    }
}

From source file:org.apache.accumulo.core.client.impl.ReplicationClient.java

License:Apache License

public static void close(ReplicationServicer.Iface iface) {
    TServiceClient client = (TServiceClient) iface;
    if (client != null && client.getInputProtocol() != null
            && client.getInputProtocol().getTransport() != null) {
        ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {//from   w ww  . j  a  v a2s . c  o m
        log.debug("Attempt to close null connection to the remote system", new Exception());
    }
}

From source file:org.apache.accumulo.core.clientImpl.ReplicationClient.java

License:Apache License

private static void close(TServiceClient client) {
    if (client != null && client.getInputProtocol() != null
            && client.getInputProtocol().getTransport() != null) {
        ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {// w w  w  .j a va  2  s .  c  o m
        log.debug("Attempt to close null connection to the remote system", new Exception());
    }
}

From source file:org.apache.accumulo.core.clientImpl.ServerClient.java

License:Apache License

public static void close(TServiceClient client) {
    if (client != null && client.getInputProtocol() != null
            && client.getInputProtocol().getTransport() != null) {
        ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
    } else {/*from w w  w.  j  a  v  a2s.co m*/
        log.debug("Attempt to close null connection to a server", new Exception());
    }
}

From source file:org.apache.accumulo.core.rpc.ThriftUtil.java

License:Apache License

/**
 * Return the transport used by the client to the shared pool.
 *
 * @param iface/*from   w w w  .  j a v a 2 s .  c o m*/
 *          The Client being returned or null.
 */
public static void returnClient(TServiceClient iface) { // Eew... the typing here is horrible
    if (iface != null) {
        ThriftTransportPool.getInstance().returnTransport(iface.getInputProtocol().getTransport());
    }
}

From source file:org.apache.accumulo.core.util.ThriftUtil.java

License:Apache License

static public void returnClient(TServiceClient iface) { // Eew... the typing here is horrible
    if (iface != null) {
        ThriftTransportPool.getInstance().returnTransport(iface.getInputProtocol().getTransport());
    }/*from  w w w. ja  va2 s.  c  om*/
}