akka.actor.Address.port()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中akka.actor.Address.port()方法的一些代码示例,展示了Address.port()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.port()方法的具体详情如下:
包路径:akka.actor.Address
类名称:Address
方法名:port

Address.port介绍

暂无

代码示例

代码示例来源:origin: apache/flink

scala.Option<Object> portOption = AkkaUtils.getAddress(getContext().system()).port();
int actorSystemPort = portOption.isDefined() ? (int) portOption.get() : -1;

代码示例来源:origin: apache/flink

final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get();

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

public static ActorSystem startJobClientActorSystem(Configuration config)
    throws IOException {
  LOG.info("Starting JobClient actor system");
  Option<Tuple2<String, Object>> remoting = new Some<>(new Tuple2<String, Object>("", 0));
  // start a remote actor system to listen on an arbitrary port
  ActorSystem system = AkkaUtils.createActorSystem(config, remoting);
  Address address = system.provider().getDefaultAddress();
  String hostAddress = address.host().isDefined() ?
      NetUtils.ipAddressToUrlString(InetAddress.getByName(address.host().get())) :
      "(unknown)";
  int port = address.port().isDefined() ? ((Integer) address.port().get()) : -1;
  LOG.info("Started JobClient actor system at " + hostAddress + ':' + port);
  return system;
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

public LeaderConnectionInfo(String address, UUID leaderSessionID) throws FlinkException {
  this.address = address;
  this.leaderSessionID = leaderSessionID;
  final Address akkaAddress;
  // this only works as long as the address is Akka based
  try {
    akkaAddress = AkkaUtils.getAddressFromAkkaURL(address);
  } catch (MalformedURLException e) {
    throw new FlinkException("Could not extract the hostname from the given address \'" +
      address + "\'.", e);
  }
  if (akkaAddress.host().isDefined()) {
    hostname = akkaAddress.host().get();
  } else {
    hostname = "localhost";
  }
  if (akkaAddress.port().isDefined()) {
    port = (int) akkaAddress.port().get();
  } else {
    port = -1;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

public LeaderConnectionInfo(String address, UUID leaderSessionID) throws FlinkException {
  this.address = address;
  this.leaderSessionID = leaderSessionID;
  final Address akkaAddress;
  // this only works as long as the address is Akka based
  try {
    akkaAddress = AkkaUtils.getAddressFromAkkaURL(address);
  } catch (MalformedURLException e) {
    throw new FlinkException("Could not extract the hostname from the given address \'" +
      address + "\'.", e);
  }
  if (akkaAddress.host().isDefined()) {
    hostname = akkaAddress.host().get();
  } else {
    hostname = "localhost";
  }
  if (akkaAddress.port().isDefined()) {
    port = (int) akkaAddress.port().get();
  } else {
    port = -1;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime

public LeaderConnectionInfo(String address, UUID leaderSessionID) throws FlinkException {
  this.address = address;
  this.leaderSessionID = leaderSessionID;
  final Address akkaAddress;
  // this only works as long as the address is Akka based
  try {
    akkaAddress = AkkaUtils.getAddressFromAkkaURL(address);
  } catch (MalformedURLException e) {
    throw new FlinkException("Could not extract the hostname from the given address \'" +
      address + "\'.", e);
  }
  if (akkaAddress.host().isDefined()) {
    hostname = akkaAddress.host().get();
  } else {
    hostname = "localhost";
  }
  if (akkaAddress.port().isDefined()) {
    port = (int) akkaAddress.port().get();
  } else {
    port = -1;
  }
}

代码示例来源:origin: com.alibaba.blink/flink-runtime

public AkkaRpcService(final ActorSystem actorSystem, final Time timeout) {
  this.actorSystem = checkNotNull(actorSystem, "actor system");
  this.timeout = checkNotNull(timeout, "timeout");
  if (actorSystem.settings().config().hasPath(MAXIMUM_FRAME_SIZE_PATH)) {
    maximumFramesize = actorSystem.settings().config().getBytes(MAXIMUM_FRAME_SIZE_PATH);
  } else {
    // only local communication
    maximumFramesize = Long.MAX_VALUE;
  }
  Address actorSystemAddress = AkkaUtils.getAddress(actorSystem);
  if (actorSystemAddress.host().isDefined()) {
    address = actorSystemAddress.host().get();
  } else {
    address = "";
  }
  if (actorSystemAddress.port().isDefined()) {
    port = (Integer) actorSystemAddress.port().get();
  } else {
    port = -1;
  }
  internalScheduledExecutor = new ActorSystemScheduledExecutorAdapter(actorSystem);
  terminationFuture = new CompletableFuture<>();
  stopped = false;
}

代码示例来源:origin: org.apache.flink/flink-runtime

public AkkaRpcService(final ActorSystem actorSystem, final Time timeout) {
  this.actorSystem = checkNotNull(actorSystem, "actor system");
  this.timeout = checkNotNull(timeout, "timeout");
  if (actorSystem.settings().config().hasPath(MAXIMUM_FRAME_SIZE_PATH)) {
    maximumFramesize = actorSystem.settings().config().getBytes(MAXIMUM_FRAME_SIZE_PATH);
  } else {
    // only local communication
    maximumFramesize = Long.MAX_VALUE;
  }
  Address actorSystemAddress = AkkaUtils.getAddress(actorSystem);
  if (actorSystemAddress.host().isDefined()) {
    address = actorSystemAddress.host().get();
  } else {
    address = "";
  }
  if (actorSystemAddress.port().isDefined()) {
    port = (Integer) actorSystemAddress.port().get();
  } else {
    port = -1;
  }
  internalScheduledExecutor = new ActorSystemScheduledExecutorAdapter(actorSystem);
  terminationFuture = new CompletableFuture<>();
  stopped = false;
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

public AkkaRpcService(final ActorSystem actorSystem, final Time timeout) {
  this.actorSystem = checkNotNull(actorSystem, "actor system");
  this.timeout = checkNotNull(timeout, "timeout");
  if (actorSystem.settings().config().hasPath(MAXIMUM_FRAME_SIZE_PATH)) {
    maximumFramesize = actorSystem.settings().config().getBytes(MAXIMUM_FRAME_SIZE_PATH);
  } else {
    // only local communication
    maximumFramesize = Long.MAX_VALUE;
  }
  Address actorSystemAddress = AkkaUtils.getAddress(actorSystem);
  if (actorSystemAddress.host().isDefined()) {
    address = actorSystemAddress.host().get();
  } else {
    address = "";
  }
  if (actorSystemAddress.port().isDefined()) {
    port = (Integer) actorSystemAddress.port().get();
  } else {
    port = -1;
  }
  internalScheduledExecutor = new ActorSystemScheduledExecutorAdapter(actorSystem);
  terminationFuture = new CompletableFuture<>();
  stopped = false;
}

代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore

public ActorContext(ActorSystem actorSystem, ActorRef shardManager,
    ClusterWrapper clusterWrapper, Configuration configuration,
    DatastoreContext datastoreContext, PrimaryShardInfoFutureCache primaryShardInfoCache) {
  this.actorSystem = actorSystem;
  this.shardManager = shardManager;
  this.clusterWrapper = clusterWrapper;
  this.configuration = configuration;
  this.datastoreContext = datastoreContext;
  this.dispatchers = new Dispatchers(actorSystem.dispatchers());
  this.primaryShardInfoCache = primaryShardInfoCache;
  this.shardStrategyFactory = new ShardStrategyFactory(configuration);
  setCachedProperties();
  Address selfAddress = clusterWrapper.getSelfAddress();
  if (selfAddress != null && !selfAddress.host().isEmpty()) {
    selfAddressHostPort = selfAddress.host().get() + ":" + selfAddress.port().get();
  } else {
    selfAddressHostPort = null;
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.10

config.setString(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, address.port().get().toString());

代码示例来源:origin: org.apache.flink/flink-yarn_2.11

scala.Option<Object> portOption = AkkaUtils.getAddress(getContext().system()).port();
int actorSystemPort = portOption.isDefined() ? (int) portOption.get() : -1;

代码示例来源:origin: org.apache.flink/flink-yarn

scala.Option<Object> portOption = AkkaUtils.getAddress(getContext().system()).port();
int actorSystemPort = portOption.isDefined() ? (int) portOption.get() : -1;

代码示例来源:origin: org.apache.flink/flink-yarn_2.11

final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get();

代码示例来源:origin: org.apache.flink/flink-yarn

final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get();

相关文章