@Override public TProtocol getProtocol(TTransport trans) { return new TraceProtocol(trans); } }
private void returnMasterConnection(MasterClientService.Client client) { ThriftUtil.returnClient(client); }
public static SslConnectionParams forServer(AccumuloConfiguration configuration) { return forConfig(configuration, true); }
private TabletClientService.Iface getClient(HostAndPort location) throws TTransportException { TabletClientService.Iface client; if (timeout < context.getClientTimeoutInMillis()) client = ThriftUtil.getTServerClient(location, context, timeout); else client = ThriftUtil.getTServerClient(location, context); return client; }
/** * Create a Thrift client using the given factory with a pooled transport (if available), the * address, and client context with no timeout. * * @param factory * Thrift client factory * @param address * Server address for client to connect to * @param context * RPC options */ public static <T extends TServiceClient> T getClientNoTimeout(TServiceClientFactory<T> factory, HostAndPort address, ClientContext context) throws TTransportException { return getClient(factory, address, context, 0); }
public void setKeyStoreFromConf(AccumuloConfiguration conf) throws FileNotFoundException { keyStoreSet = true; keyStorePath = storePathFromConf(conf, Property.RPC_SSL_KEYSTORE_PATH); keyStorePass = passwordFromConf(conf, conf.get(Property.INSTANCE_SECRET), Property.RPC_SSL_KEYSTORE_PASSWORD); keyStoreType = conf.get(Property.RPC_SSL_KEYSTORE_TYPE); }
@Override public boolean equals(Object o) { if (!(o instanceof ThriftTransportKey)) return false; ThriftTransportKey ttk = (ThriftTransportKey) o; return server.equals(ttk.server) && timeout == ttk.timeout && (!isSsl() || (ttk.isSsl() && sslParams.equals(ttk.sslParams))) && (!isSasl() || (ttk.isSasl() && saslParams.equals(ttk.saslParams))); }
@Override public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort) throws IOException, UnknownHostException { final Socket underlyingSocket = delegate.createSocket(host, port, localAddress, localPort); return overrideProtocol(underlyingSocket); }
/** * Creates a Thrift TTransport to the given address with the given timeout. All created resources * are closed if an exception is thrown. * * @param addr * The address to connect the client to * @param timeoutMillis * The timeout in milliseconds for the connection * @return A TTransport connected to the given <code>addr</code> * @throws IOException * If the transport fails to be created/connected */ public static TTransport create(SocketAddress addr, long timeoutMillis) throws IOException { return INSTANCE.createInternal(addr, timeoutMillis); }
/** * Create a Thrift client using the given factory and transport */ public static <T extends TServiceClient> T createClient(TServiceClientFactory<T> factory, TTransport transport) { return factory.getClient(protocolFactory.getProtocol(transport), protocolFactory.getProtocol(transport)); }
@Override public int hashCode() { HashCodeBuilder hcb = new HashCodeBuilder(23, 29); hcb.append(kerberosServerPrimary).append(saslProperties).append(qop.hashCode()) .append(principal).append(mechanism).append(callbackHandler); return hcb.toHashCode(); }
public static SaslConnectionParams from(AccumuloConfiguration config, AuthenticationToken token) { if (!config.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) { return null; } return new SaslConnectionParams(config, token); }
/** * Retrieve the SSL/TLS configuration for starting up a listening service */ public SslConnectionParams getServerSslParams() { return SslConnectionParams.forServer(getConfiguration()); }
/** * @see #startTServer(ThriftServerType, TimedProcessor, TProtocolFactory, String, String, int, * int, long, long, SslConnectionParams, SaslServerConnectionParams, long, HostAndPort...) */ public static ServerAddress startTServer(ThriftServerType serverType, TimedProcessor processor, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks, long maxMessageSize, SslConnectionParams sslParams, SaslServerConnectionParams saslParams, long serverSocketTimeout, HostAndPort... addresses) throws TTransportException { return startTServer(serverType, processor, ThriftUtil.protocolFactory(), serverName, threadName, numThreads, numSTThreads, timeBetweenThreadChecks, maxMessageSize, sslParams, saslParams, serverSocketTimeout, addresses); }
/** * Create a TabletServer Thrift client * * @param address * Server address for client to connect to * @param context * RPC options */ public static TabletClientService.Client getTServerClient(HostAndPort address, ClientContext context) throws TTransportException { return getClient(new TabletClientService.Client.Factory(), address, context); }
@Override public Socket createSocket(final String host, final int port) throws IOException, UnknownHostException { final Socket underlyingSocket = delegate.createSocket(host, port); return overrideProtocol(underlyingSocket); }
public static SslConnectionParams forClient(AccumuloConfiguration configuration) { return forConfig(configuration, false); }
@Override public Socket createSocket(final InetAddress host, final int port) throws IOException { final Socket underlyingSocket = delegate.createSocket(host, port); return overrideProtocol(underlyingSocket); }
@Override public Socket createSocket(final Socket socket, final String host, final int port, final boolean autoClose) throws IOException { final Socket underlyingSocket = delegate.createSocket(socket, host, port, autoClose); return overrideProtocol(underlyingSocket); }
@Override public Socket createSocket(final InetAddress host, final int port, final InetAddress localAddress, final int localPort) throws IOException { final Socket underlyingSocket = delegate.createSocket(host, port, localAddress, localPort); return overrideProtocol(underlyingSocket); }