當前位置: 首頁>>代碼示例>>Java>>正文


Java RPC.Server方法代碼示例

本文整理匯總了Java中org.apache.hadoop.ipc.RPC.Server方法的典型用法代碼示例。如果您正苦於以下問題:Java RPC.Server方法的具體用法?Java RPC.Server怎麽用?Java RPC.Server使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.ipc.RPC的用法示例。


在下文中一共展示了RPC.Server方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: newRpcServer

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
private static RPC.Server newRpcServer(
    RaftServerProtocol serverProtocol, final Configuration conf)
    throws IOException {
  final int handlerCount = HadoopConfigKeys.Ipc.handlers(conf);
  final InetSocketAddress address = HadoopConfigKeys.Ipc.address(conf);

  final BlockingService service
      = RaftServerProtocolService.newReflectiveBlockingService(
          new RaftServerProtocolServerSideTranslatorPB(serverProtocol));
  RPC.setProtocolEngine(conf, RaftServerProtocolPB.class, ProtobufRpcEngineShaded.class);
  return new RPC.Builder(conf)
      .setProtocol(RaftServerProtocolPB.class)
      .setInstance(service)
      .setBindAddress(address.getHostName())
      .setPort(address.getPort())
      .setNumHandlers(handlerCount)
      .setVerbose(false)
      .build();
}
 
開發者ID:apache,項目名稱:incubator-ratis,代碼行數:20,代碼來源:HadoopRpcService.java

示例2: main

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
	Configuration conf = new Configuration();
	RPC.Server server = RPC.getServer(new DemoServiceImpl(),
			conf.get("server.ip.name"),
			conf.getInt("name:port", 8888),
			3,
			true,
			conf);
	server.start();
	// server.stop();
}
 
開發者ID:spafka,項目名稱:spark_deep,代碼行數:12,代碼來源:RpcServer.java

示例3: createServer

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
private Server createServer(Class<?> pbProtocol, InetSocketAddress addr, Configuration conf, 
    SecretManager<? extends TokenIdentifier> secretManager, int numHandlers, 
    BlockingService blockingService, String portRangeConfig) throws IOException {
  RPC.setProtocolEngine(conf, pbProtocol, ProtobufRpcEngine.class);
  RPC.Server server = new RPC.Builder(conf).setProtocol(pbProtocol)
      .setInstance(blockingService).setBindAddress(addr.getHostName())
      .setPort(addr.getPort()).setNumHandlers(numHandlers).setVerbose(false)
      .setSecretManager(secretManager).setPortRangeConfig(portRangeConfig)
      .build();
  LOG.info("Adding protocol "+pbProtocol.getCanonicalName()+" to the server");
  server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, pbProtocol, blockingService);
  return server;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:14,代碼來源:RpcServerFactoryPBImpl.java

示例4: getLifelineRpcServer

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
/** Allow access to the lifeline RPC server for testing */
@VisibleForTesting
RPC.Server getLifelineRpcServer() {
  return lifelineRpcServer;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:6,代碼來源:NameNodeRpcServer.java

示例5: getClientRpcServer

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
/** Allow access to the client RPC server for testing */
@VisibleForTesting
RPC.Server getClientRpcServer() {
  return clientRpcServer;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:6,代碼來源:NameNodeRpcServer.java

示例6: getServiceRpcServer

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
/** Allow access to the service RPC server for testing */
@VisibleForTesting
RPC.Server getServiceRpcServer() {
  return serviceRpcServer;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:6,代碼來源:NameNodeRpcServer.java

示例7: addPBProtocol

import org.apache.hadoop.ipc.RPC; //導入方法依賴的package包/類
/**
 * Add protobuf based protocol to the {@link org.apache.hadoop.ipc.RPC.Server}
 * @param conf configuration
 * @param protocol Protocol interface
 * @param service service that implements the protocol
 * @param server RPC server to which the protocol & implementation is added to
 * @throws IOException
 */
public static void addPBProtocol(Configuration conf, Class<?> protocol,
    BlockingService service, RPC.Server server) throws IOException {
  RPC.setProtocolEngine(conf, protocol, ProtobufRpcEngine.class);
  server.addProtocol(RPC.RpcKind.RPC_PROTOCOL_BUFFER, protocol, service);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:14,代碼來源:DFSUtil.java


注:本文中的org.apache.hadoop.ipc.RPC.Server方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。