static DomainPeerServer getDomainPeerServer(Configuration conf, int port) throws IOException { String domainSocketPath = conf.getTrimmed(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY, DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_DEFAULT); if (domainSocketPath.isEmpty()) { if (conf.getBoolean(DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_KEY, DFSConfigKeys.DFS_CLIENT_READ_SHORTCIRCUIT_DEFAULT) && (!conf.getBoolean(DFSConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL, DFSConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL_DEFAULT))) { LOG.warn("Although short-circuit local reads are configured, " + "they are disabled because you didn't configure " + DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY); } return null; } if (DomainSocket.getLoadingFailureReason() != null) { throw new RuntimeException("Although a UNIX domain socket " + "path is configured as " + domainSocketPath + ", we cannot " + "start a localDataXceiverServer because " + DomainSocket.getLoadingFailureReason()); } DomainPeerServer domainPeerServer = new DomainPeerServer(domainSocketPath, port); domainPeerServer.setReceiveBufferSize( HdfsConstants.DEFAULT_DATA_SOCKET_SIZE); return domainPeerServer; }
private static DomainPeerServer getDomainPeerServer(Configuration conf, int port) throws IOException { String domainSocketPath = conf.getTrimmed(DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY, DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_DEFAULT); if (domainSocketPath.isEmpty()) { if (conf.getBoolean(HdfsClientConfigKeys.Read.ShortCircuit.KEY, HdfsClientConfigKeys.Read.ShortCircuit.DEFAULT) && (!conf.getBoolean(HdfsClientConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL, HdfsClientConfigKeys.DFS_CLIENT_USE_LEGACY_BLOCKREADERLOCAL_DEFAULT))) { LOG.warn("Although short-circuit local reads are configured, " + "they are disabled because you didn't configure " + DFSConfigKeys.DFS_DOMAIN_SOCKET_PATH_KEY); } return null; } if (DomainSocket.getLoadingFailureReason() != null) { throw new RuntimeException("Although a UNIX domain socket " + "path is configured as " + domainSocketPath + ", we cannot " + "start a localDataXceiverServer because " + DomainSocket.getLoadingFailureReason()); } DomainPeerServer domainPeerServer = new DomainPeerServer(domainSocketPath, port); int recvBufferSize = conf.getInt( DFSConfigKeys.DFS_DATANODE_TRANSFER_SOCKET_RECV_BUFFER_SIZE_KEY, DFSConfigKeys.DFS_DATANODE_TRANSFER_SOCKET_RECV_BUFFER_SIZE_DEFAULT); if (recvBufferSize > 0) { domainPeerServer.setReceiveBufferSize(recvBufferSize); } return domainPeerServer; }