@Override public void preStart() { logger.debug("{} role {} address {}:{} starting up, subscribing to cluster events...", name, cluster.getSelfRoles().iterator().next(), cluster.readView().selfAddress().host(), cluster.readView().selfAddress().hostPort()); cluster.subscribe(getSelf(), ClusterEvent.MemberEvent.class, ClusterEvent.ReachabilityEvent.class); }
final String akkaHostname = AkkaUtils.getAddress(actorSystem).host().get(); final int akkaPort = (Integer) AkkaUtils.getAddress(actorSystem).port().get();
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; }
@Override public BlobCache checkedApply(Object result) throws IOException { Option<String> hostOption = jobManager.actor().path().address().host(); String host = hostOption.isDefined() ? hostOption.get() : "localhost"; int port = (int) result; return new BlobCache(new InetSocketAddress(host, port), config, blobView); } }, executor);
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; } }
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; } }
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; } }
private Tuple2<String, String> extractAddressHostname(ActorRef actorRef) { final String actorAddress = AkkaUtils.getAkkaURL(actorSystem, actorRef); final String hostname; Option<String> host = actorRef.path().address().host(); if (host.isEmpty()) { hostname = "localhost"; } else { hostname = host.get(); } return Tuple2.of(actorAddress, hostname); }
public AkkaJobManagerGateway(ActorGateway jobManagerGateway) { this.jobManagerGateway = Preconditions.checkNotNull(jobManagerGateway); final Option<String> optHostname = jobManagerGateway.actor().path().address().host(); hostname = optHostname.isDefined() ? optHostname.get() : "localhost"; }
private Tuple2<String, String> extractAddressHostname(ActorRef actorRef) { final String actorAddress = AkkaUtils.getAkkaURL(actorSystem, actorRef); final String hostname; Option<String> host = actorRef.path().address().host(); if (host.isEmpty()) { hostname = "localhost"; } else { hostname = host.get(); } return Tuple2.of(actorAddress, hostname); }
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; } }
public AkkaJobManagerGateway(ActorGateway jobManagerGateway) { this.jobManagerGateway = Preconditions.checkNotNull(jobManagerGateway); final Option<String> optHostname = jobManagerGateway.actor().path().address().host(); hostname = optHostname.isDefined() ? optHostname.get() : "localhost"; }
private Tuple2<String, String> extractAddressHostname(ActorRef actorRef) { final String actorAddress = AkkaUtils.getAkkaURL(actorSystem, actorRef); final String hostname; Option<String> host = actorRef.path().address().host(); if (host.isEmpty()) { hostname = "localhost"; } else { hostname = host.get(); } return Tuple2.of(actorAddress, hostname); }
public AkkaJobManagerGateway(ActorGateway jobManagerGateway) { this.jobManagerGateway = Preconditions.checkNotNull(jobManagerGateway); final Option<String> optHostname = jobManagerGateway.actor().path().address().host(); hostname = optHostname.isDefined() ? optHostname.get() : "localhost"; }
private void handleMemberUp(final ClusterEvent.MemberUp memberUp) { final Member upMember = memberUp.member(); log.debug("Member is UP: {}", upMember); final Address address = upMember.address(); if (address.host().isDefined()) { try { final InetAddress inetAddress = InetAddress.getByName(address.host().get()); log.debug("Found DNS entry '{}' for UP member: '{}'", inetAddress, upMember); knownAddresses.put(inetAddress.getHostName(), address); } catch (final UnknownHostException ex) { log.error(ex, "No DNS entry found for UP member: '{}'", upMember); } } else { log.warning("No host defined in address '{}' for UP member: '{}'", address, upMember); } scheduleMajorityCheck(); cluster.sendCurrentClusterState(getSelf()); }
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 = ""; } internalScheduledExecutor = new InternalScheduledExecutorImpl(actorSystem); }
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; }
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; }
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; }