org.apache.reef.io.network.naming.parameters.NameResolverNameServerPort Java Examples

The following examples show how to use org.apache.reef.io.network.naming.parameters.NameResolverNameServerPort. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroupCommDriverImpl.java    From reef with Apache License 2.0 6 votes vote down vote up
@Override
public Configuration getServiceConfiguration() {
  LOG.entering("GroupCommDriverImpl", "getServiceConf");
  final Configuration serviceConfiguration = ServiceConfiguration.CONF.set(ServiceConfiguration.SERVICES,
      NetworkService.class)
      .set(ServiceConfiguration.SERVICES,
          GroupCommNetworkHandlerImpl.class)
      .set(ServiceConfiguration.ON_CONTEXT_STOP,
          NetworkServiceClosingHandler.class)
      .set(ServiceConfiguration.ON_TASK_STARTED,
          BindNSToTask.class)
      .set(ServiceConfiguration.ON_TASK_STOP,
          UnbindNSFromTask.class).build();
  final Configuration retVal = TANG.newConfigurationBuilder(serviceConfiguration)
      .bindNamedParameter(NetworkServiceParameters.NetworkServiceCodec.class,
          GroupCommunicationMessageCodec.class)
      .bindNamedParameter(NetworkServiceParameters.NetworkServiceHandler.class,
          GroupCommNetworkHandlerImpl.class)
      .bindNamedParameter(NetworkServiceParameters.NetworkServiceExceptionHandler.class,
          ExceptionHandler.class)
      .bindNamedParameter(NameResolverNameServerAddr.class, nameServiceAddr)
      .bindNamedParameter(NameResolverNameServerPort.class, Integer.toString(nameServicePort))
      .bindNamedParameter(NetworkServiceParameters.NetworkServicePort.class, "0").build();
  LOG.exiting("GroupCommDriverImpl", "getServiceConf", confSerializer.toString(retVal));
  return retVal;
}
 
Example #2
Source File: NameLookupClient.java    From reef with Apache License 2.0 6 votes vote down vote up
/**
  * Constructs a naming lookup client.
  *
  * @param serverAddr a server address
  * @param serverPort a server port number
  * @param timeout    request timeout in ms
  * @param factory    an identifier factory
  * @param tpFactory  a transport factory
  */
@Inject
private NameLookupClient(
          @Parameter(NameResolverNameServerAddr.class) final String serverAddr,
          @Parameter(NameResolverNameServerPort.class) final int serverPort,
          @Parameter(NameResolverCacheTimeout.class) final long timeout,
          @Parameter(NameResolverIdentifierFactory.class) final IdentifierFactory factory,
          @Parameter(NameResolverRetryCount.class) final int retryCount,
          @Parameter(NameResolverRetryTimeout.class) final int retryTimeout,
          final LocalAddressProvider localAddressProvider,
          final TransportFactory tpFactory) {
  this.serverSocketAddr = new InetSocketAddress(serverAddr, serverPort);
  this.timeout = timeout;
  this.cache = new NameCache(timeout);
  this.codec = NamingCodecFactory.createLookupCodec(factory);
  this.replyQueue = new LinkedBlockingQueue<>();

  this.transport = tpFactory.newInstance(localAddressProvider.getLocalAddress(), 0,
          new SyncStage<>(new NamingLookupClientHandler(
                  new NamingLookupResponseHandler(this.replyQueue), this.codec)),
          null, retryCount, retryTimeout);

  this.retryCount = retryCount;
  this.retryTimeout = retryTimeout;
}
 
Example #3
Source File: NemoDriver.java    From incubator-nemo with Apache License 2.0 5 votes vote down vote up
private Configuration getExecutorNcsConfiguration() {
  return Tang.Factory.getTang().newConfigurationBuilder()
    .bindNamedParameter(NameResolverNameServerPort.class, Integer.toString(nameServer.getPort()))
    .bindNamedParameter(NameResolverNameServerAddr.class, localAddressProvider.getLocalAddress())
    .bindImplementation(IdentifierFactory.class, StringIdentifierFactory.class)
    .build();
}
 
Example #4
Source File: NemoDriver.java    From nemo with Apache License 2.0 5 votes vote down vote up
private Configuration getExecutorNcsConfiguration() {
  return Tang.Factory.getTang().newConfigurationBuilder()
      .bindNamedParameter(NameResolverNameServerPort.class, Integer.toString(nameServer.getPort()))
      .bindNamedParameter(NameResolverNameServerAddr.class, localAddressProvider.getLocalAddress())
      .bindImplementation(IdentifierFactory.class, StringIdentifierFactory.class)
      .build();
}