public DriftClientFactory createDriftClientFactory(I clientIdentity, AddressSelector<?> addressSelector, ExceptionClassifier exceptionClassifier) { return new DriftClientFactory( codecManager, () -> methodInvokerFactory.createMethodInvoker(clientIdentity), addressSelector, exceptionClassifier, methodInvocationStatsFactory); } }
public DriftClientFactory createDriftClientFactory(I clientIdentity, AddressSelector<?> addressSelector, ExceptionClassifier exceptionClassifier) { return new DriftClientFactory( codecManager, () -> methodInvokerFactory.createMethodInvoker(clientIdentity), addressSelector, exceptionClassifier, methodInvocationStatsFactory); } }
private static int logApacheThriftStaticDriftClient( HostAndPort address, String headerValue, List<DriftLogEntry> entries, List<MethodInvocationFilter> filters, Transport transport, Protocol protocol, boolean secure) { if (!isValidConfiguration(transport, protocol)) { return 0; } AddressSelector<?> addressSelector = context -> Optional.of(() -> address); ApacheThriftClientConfig config = new ApacheThriftClientConfig() .setTransport(toApacheThriftTransport(transport)) .setProtocol(toApacheThriftProtocol(protocol)) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setSslEnabled(secure); try (ApacheThriftMethodInvokerFactory<?> methodInvokerFactory = createStaticApacheThriftMethodInvokerFactory(config)) { DriftClientFactory proxyFactory = new DriftClientFactory(CODEC_MANAGER, methodInvokerFactory, addressSelector); DriftScribe scribe = proxyFactory.createDriftClient(DriftScribe.class, Optional.empty(), filters, new DriftClientConfig()).get(); assertEquals(scribe.log(headerValue, entries), DRIFT_OK); } catch (Exception e) { throw new RuntimeException(e); } return 1; }
private static int logNettyStaticDriftClient( HostAndPort address, String headerValue, List<DriftLogEntry> entries, List<MethodInvocationFilter> filters, Transport transport, Protocol protocol, boolean secure) { if (!isValidConfiguration(transport, protocol)) { return 0; } AddressSelector<?> addressSelector = context -> Optional.of(() -> address); DriftNettyClientConfig config = new DriftNettyClientConfig() .setTransport(transport) .setProtocol(protocol) .setTrustCertificate(ClientTestUtils.getCertificateChainFile()) .setSslEnabled(secure); try (TestingPooledByteBufAllocator testingAllocator = new TestingPooledByteBufAllocator(); DriftNettyMethodInvokerFactory<?> methodInvokerFactory = createStaticDriftNettyMethodInvokerFactory(config, testingAllocator)) { DriftClientFactory proxyFactory = new DriftClientFactory(CODEC_MANAGER, methodInvokerFactory, addressSelector); DriftScribe scribe = proxyFactory.createDriftClient(DriftScribe.class, Optional.empty(), filters, new DriftClientConfig()).get(); assertEquals(scribe.log(headerValue, entries), DRIFT_OK); } catch (Exception e) { throw new RuntimeException(e); } return 1; }