org.apache.reef.io.network.NetworkConnectionService Java Examples

The following examples show how to use org.apache.reef.io.network.NetworkConnectionService. 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: NcsMessageEnvironment.java    From incubator-nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private NcsMessageEnvironment(
  final NetworkConnectionService networkConnectionService,
  final IdentifierFactory idFactory,
  @Parameter(MessageParameters.SenderId.class) final String senderId) {
  this.networkConnectionService = networkConnectionService;
  this.idFactory = idFactory;
  this.senderId = senderId;
  this.replyFutureMap = new ReplyFutureMap<>();
  this.listenerConcurrentMap = new ConcurrentHashMap<>();
  this.receiverToConnectionMap = new ConcurrentHashMap<>();
  this.connectionFactory = networkConnectionService.registerConnectionFactory(
    idFactory.getNewInstance(NCS_CONN_FACTORY_ID),
    new ControlMessageCodec(),
    new NcsMessageHandler(),
    new NcsLinkListener(),
    idFactory.getNewInstance(senderId));
}
 
Example #2
Source File: NcsMessageEnvironment.java    From nemo with Apache License 2.0 6 votes vote down vote up
@Inject
private NcsMessageEnvironment(
    final NetworkConnectionService networkConnectionService,
    final IdentifierFactory idFactory,
    @Parameter(MessageParameters.SenderId.class) final String senderId) {
  this.networkConnectionService = networkConnectionService;
  this.idFactory = idFactory;
  this.senderId = senderId;
  this.replyFutureMap = new ReplyFutureMap<>();
  this.listenerConcurrentMap = new ConcurrentHashMap<>();
  this.receiverToConnectionMap = new HashMap<>();
  this.connectionFactory = networkConnectionService.registerConnectionFactory(
      idFactory.getNewInstance(NCS_CONN_FACTORY_ID),
      new ControlMessageCodec(),
      new NcsMessageHandler(),
      new NcsLinkListener(),
      idFactory.getNewInstance(senderId));
}
 
Example #3
Source File: NetworkMessagingTestService.java    From reef with Apache License 2.0 6 votes vote down vote up
public NetworkMessagingTestService(final String localAddress) throws InjectionException {
  // name server
  final Injector injector = Tang.Factory.getTang().newInjector();
  this.nameServer = injector.getInstance(NameServer.class);
  final Configuration netConf = NameResolverConfiguration.CONF
      .set(NameResolverConfiguration.NAME_SERVER_HOSTNAME, localAddress)
      .set(NameResolverConfiguration.NAME_SERVICE_PORT, nameServer.getPort())
      .build();

  LOG.log(Level.FINEST, "=== Test network connection service receiver start");
  // network service for receiver
  final Injector injectorReceiver = injector.forkInjector(netConf);
  this.receiverNetworkConnService = injectorReceiver.getInstance(NetworkConnectionService.class);
  this.factory = injectorReceiver.getNamedInstance(NetworkConnectionServiceIdFactory.class);

  // network service for sender
  LOG.log(Level.FINEST, "=== Test network connection service sender start");
  final Injector injectorSender = injector.forkInjector(netConf);
  senderNetworkConnService = injectorSender.getInstance(NetworkConnectionService.class);
}