Examples of FramedClientConnector


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

Examples of com.facebook.nifty.client.FramedClientConnector

            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

Examples of com.facebook.nifty.client.FramedClientConnector

    {
        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

Examples of com.facebook.nifty.client.FramedClientConnector

    {
        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

Examples of com.facebook.nifty.client.FramedClientConnector

        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

Examples of com.facebook.nifty.client.FramedClientConnector

        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

Examples of com.facebook.nifty.client.FramedClientConnector

    @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

Examples of com.facebook.nifty.client.FramedClientConnector

  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

Examples of com.facebook.nifty.client.FramedClientConnector

                            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

Examples of com.facebook.nifty.client.FramedClientConnector

                            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
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.