Package com.facebook.nifty.client

Examples of com.facebook.nifty.client.FramedClientConnector


    private ListenableFuture<? extends ClientInterface> createClient(ThriftClientManager clientManager)
            throws TTransportException, InterruptedException, ExecutionException
    {
        HostAndPort address = HostAndPort.fromParts("localhost", server.getPort());
        return clientManager.createClient(new FramedClientConnector(address), clientClass);
    }
View Full Code Here


            throws Exception
    {
        try (
                ThriftClientManager clientManager = new ThriftClientManager();
                Scribe scribe = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", port)),
                        Scribe.class).get()
        ) {
            return scribe.log(entries);
        }
    }
View Full Code Here

    {
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(Duration.valueOf("1s"))
                                                            .setReadTimeout(Duration.valueOf("1s"))
                                                            .setWriteTimeout(Duration.valueOf("1s"));
        ThriftClient<Scribe> thriftClient = new ThriftClient<>(manager, Scribe.class, config, "ScribeClient");
        return thriftClient.open(new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort()),
                                                           TDuplexProtocolFactory.fromSingleFactory(protocolFactory))).get();
    }
View Full Code Here

    {
        HostAndPort address = HostAndPort.fromParts("localhost", serverPort);
        ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setReadTimeout(new Duration(1, TimeUnit.SECONDS))
                                                            .setWriteTimeout(new Duration(1, TimeUnit.SECONDS));
        FramedClientConnector connector = new FramedClientConnector(address) {
            @Override
            public FramedClientChannel newThriftClientChannel(
                    Channel nettyChannel, Timer timer)
            {
                if (connectDelay.toMillis() > 0) {
View Full Code Here

        niftyClient = null;
    }

    public T newClient(final InetSocketAddress inetSocketAddress) throws TTransportException, InterruptedException {
        final TDuplexProtocolFactory duplexProtocolFactory = TDuplexProtocolFactory.fromSingleFactory(configuration.protocolFactory);
        final FramedClientConnector framedClientConnector = new FramedClientConnector(inetSocketAddress, duplexProtocolFactory);
        final TProtocol protocol = configuration.protocolFactory.getProtocol(niftyClient.connectSync(configuration.clientType, framedClientConnector));
        return configuration.clientFactory.getClient(protocol);
    }
View Full Code Here

        int port = serverSocket.getLocalPort();

        final NiftyClient client = new NiftyClient();
        try {
            ListenableFuture<FramedClientChannel> future =
                            client.connectAsync(new FramedClientConnector(new InetSocketAddress(port)),
                                                TEST_CONNECT_TIMEOUT,
                                                TEST_READ_TIMEOUT,
                                                TEST_WRITE_TIMEOUT,
                                                TEST_MAX_FRAME_SIZE);
            // Wait while NiftyClient attempts to connect the channel
View Full Code Here

    @Override
    public ListenableFuture<HiveMetastore> getClientForHostAsFuture(final HostAndPort hostAndPort, final boolean framed)
    {
        final NiftyClientConnector<? extends NiftyClientChannel> clientConnector = framed
            ? new FramedClientConnector(hostAndPort)
            : new UnframedClientConnector(hostAndPort);

        return thriftClient.open(clientConnector);
    }
View Full Code Here

  private RocksService getRocksClient() throws Exception {
    if (rocksClient.get() == null) {
      try {
        rocksClient.set(clientManager.createClient(
          new FramedClientConnector(fromParts(host, port)),
          RocksService.class).get());
        logger.info("Opened Rocksdb connection to " + host
                    + ":" + port);
      } catch (Exception e) {
        logger.error("Error in open rocksdb to " + host
View Full Code Here

                            TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>> channelConnectorType =
                                    new TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>>() {};
                            NiftyClientConnector<? extends NiftyClientChannel> connector;
                            switch (config.transport) {
                                case FRAMED:
                                    connector = new FramedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                case UNFRAMED:
                                    connector = new UnframedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                default:
View Full Code Here

                            TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>> channelConnectorType =
                                    new TypeLiteral<NiftyClientConnector<? extends NiftyClientChannel>>() {};
                            NiftyClientConnector<? extends NiftyClientChannel> connector;
                            switch (config.transport) {
                                case FRAMED:
                                    connector = new FramedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                case UNFRAMED:
                                    connector = new UnframedClientConnector(HostAndPort.fromParts(config.serverAddress, config.serverPort));
                                    break;
                                default:
View Full Code Here

TOP

Related Classes of com.facebook.nifty.client.FramedClientConnector

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.