/** Construct an IPC client whose values are of the given {@link Writable} * class. */ public Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.conf = conf; this.socketFactory = factory; this.connectionTimeout = conf.getInt(CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_KEY, CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT); this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.bindToWildCardAddress = conf .getBoolean(CommonConfigurationKeys.IPC_CLIENT_BIND_WILDCARD_ADDR_KEY, CommonConfigurationKeys.IPC_CLIENT_BIND_WILDCARD_ADDR_DEFAULT); this.clientId = ClientId.getClientId(); this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance(); this.maxAsyncCalls = conf.getInt( CommonConfigurationKeys.IPC_CLIENT_ASYNC_CALLS_MAX_KEY, CommonConfigurationKeys.IPC_CLIENT_ASYNC_CALLS_MAX_DEFAULT); }
CacheEntry(byte[] clientId, int callId, long expirationTime) { // ClientId must be a UUID - that is 16 octets. Preconditions.checkArgument(clientId.length == ClientId.BYTE_LENGTH, "Invalid clientId - length is " + clientId.length + " expected length " + ClientId.BYTE_LENGTH); // Convert UUID bytes to two longs clientIdMsb = ClientId.getMsb(clientId); clientIdLsb = ClientId.getLsb(clientId); this.callId = callId; this.expirationTime = expirationTime; }
private static void appendRpcIdsToString(final StringBuilder builder, final byte[] clientId, final int callId) { builder.append(", RpcClientId="); builder.append(ClientId.toString(clientId)); builder.append(", RpcCallId="); builder.append(callId); }
void readRpcIdsFromXml(Stanza st) { this.rpcClientId = st.hasChildren("RPC_CLIENTID") ? ClientId.toBytes(st.getValue("RPC_CLIENTID")) : RpcConstants.DUMMY_CLIENT_ID; this.rpcCallId = st.hasChildren("RPC_CALLID") ? Integer.parseInt(st.getValue("RPC_CALLID")) : RpcConstants.INVALID_CALL_ID; }
private static void appendRpcIdsToXml(ContentHandler contentHandler, final byte[] clientId, final int callId) throws SAXException { XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID", ClientId.toString(clientId)); XMLUtils.addSaxString(contentHandler, "RPC_CALLID", Integer.toString(callId)); }
void readRpcIdsFromXml(Stanza st) { this.rpcClientId = st.hasChildren("RPC_CLIENTID") ? ClientId.toBytes(st.getValue("RPC_CLIENTID")) : RpcConstants.DUMMY_CLIENT_ID; this.rpcCallId = st.hasChildren("RPC_CALLID") ? Integer.parseInt(st.getValue("RPC_CALLID")) : RpcConstants.INVALID_CALL_ID; }
/** Convert a clientId byte[] to string */ public static String toString(byte[] clientId) { // clientId can be null or an empty array if (clientId == null || clientId.length == 0) { return ""; } // otherwise should be 16 bytes Preconditions.checkArgument(clientId.length == BYTE_LENGTH); long msb = getMsb(clientId); long lsb = getLsb(clientId); return (new UUID(msb, lsb)).toString(); }
/** Construct an IPC client whose values are of the given {@link Writable} * class. */ public Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.conf = conf; this.socketFactory = factory; this.connectionTimeout = conf.getInt(CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_KEY, CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT); this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.clientId = ClientId.getClientId(); this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance(); }
private static void appendRpcIdsToString(final StringBuilder builder, final byte[] clientId, final int callId) { builder.append(", RpcClientId="); builder.append(ClientId.toString(clientId)); builder.append(", RpcCallId="); builder.append(callId); }
void readRpcIdsFromXml(Stanza st) { this.rpcClientId = st.hasChildren("RPC_CLIENTID") ? ClientId.toBytes(st.getValue("RPC_CLIENTID")) : RpcConstants.DUMMY_CLIENT_ID; this.rpcCallId = st.hasChildren("RPC_CALLID") ? Integer.parseInt(st.getValue("RPC_CALLID")) : RpcConstants.INVALID_CALL_ID; }
CacheEntry(byte[] clientId, int callId, long expirationTime) { // ClientId must be a UUID - that is 16 octets. Preconditions.checkArgument(clientId.length == ClientId.BYTE_LENGTH, "Invalid clientId - length is " + clientId.length + " expected length " + ClientId.BYTE_LENGTH); // Convert UUID bytes to two longs clientIdMsb = ClientId.getMsb(clientId); clientIdLsb = ClientId.getLsb(clientId); this.callId = callId; this.expirationTime = expirationTime; this.clientIdByte = clientId; }
/** Construct an IPC client whose values are of the given {@link Writable} * class. */ public Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.conf = conf; this.socketFactory = factory; this.connectionTimeout = conf.getInt(CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_KEY, CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT); this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.clientId = ClientId.getClientId(); this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance(); }
private static void appendRpcIdsToString(final StringBuilder builder, final byte[] clientId, final int callId) { builder.append(", RpcClientId="); builder.append(ClientId.toString(clientId)); builder.append(", RpcCallId="); builder.append(callId); }
CacheEntry(byte[] clientId, int callId, long expirationTime) { // ClientId must be a UUID - that is 16 octets. Preconditions.checkArgument(clientId.length == ClientId.BYTE_LENGTH, "Invalid clientId - length is " + clientId.length + " expected length " + ClientId.BYTE_LENGTH); // Convert UUID bytes to two longs clientIdMsb = ClientId.getMsb(clientId); clientIdLsb = ClientId.getLsb(clientId); this.callId = callId; this.expirationTime = expirationTime; }
/** Construct an IPC client whose values are of the given {@link Writable} * class. */ public Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.conf = conf; this.socketFactory = factory; this.connectionTimeout = conf.getInt(CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_KEY, CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT); this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.clientId = ClientId.getClientId(); this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance(); }
private static void appendRpcIdsToXml(ContentHandler contentHandler, final byte[] clientId, final int callId) throws SAXException { XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID", ClientId.toString(clientId)); XMLUtils.addSaxString(contentHandler, "RPC_CALLID", Integer.toString(callId)); }
CacheEntry(byte[] clientId, int callId, long expirationTime) { // ClientId must be a UUID - that is 16 octets. Preconditions.checkArgument(clientId.length == ClientId.BYTE_LENGTH, "Invalid clientId - length is " + clientId.length + " expected length " + ClientId.BYTE_LENGTH); // Convert UUID bytes to two longs clientIdMsb = ClientId.getMsb(clientId); clientIdLsb = ClientId.getLsb(clientId); this.callId = callId; this.expirationTime = expirationTime; }
/** Construct an IPC client whose values are of the given {@link Writable} * class. */ public Client(Class<? extends Writable> valueClass, Configuration conf, SocketFactory factory) { this.valueClass = valueClass; this.conf = conf; this.socketFactory = factory; this.connectionTimeout = conf.getInt(CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_KEY, CommonConfigurationKeys.IPC_CLIENT_CONNECT_TIMEOUT_DEFAULT); this.fallbackAllowed = conf.getBoolean(CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_KEY, CommonConfigurationKeys.IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH_ALLOWED_DEFAULT); this.clientId = ClientId.getClientId(); this.sendParamsExecutor = clientExcecutorFactory.refAndGetInstance(); this.maxAsyncCalls = conf.getInt( CommonConfigurationKeys.IPC_CLIENT_ASYNC_CALLS_MAX_KEY, CommonConfigurationKeys.IPC_CLIENT_ASYNC_CALLS_MAX_DEFAULT); }
private static void appendRpcIdsToXml(ContentHandler contentHandler, final byte[] clientId, final int callId) throws SAXException { XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID", ClientId.toString(clientId)); XMLUtils.addSaxString(contentHandler, "RPC_CALLID", Integer.toString(callId)); }
/** Convert a clientId byte[] to string */ public static String toString(byte[] clientId) { // clientId can be null or an empty array if (clientId == null || clientId.length == 0) { return ""; } // otherwise should be 16 bytes Preconditions.checkArgument(clientId.length == BYTE_LENGTH); long msb = getMsb(clientId); long lsb = getLsb(clientId); return (new UUID(msb, lsb)).toString(); }