protected String getActorPathName(ActorRef actorRef) { return actorRef.path().name(); }
@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);
/** * Verify the actor path of self agrees with what is advertised in ditto-services-models-concierge. * * @param self ActorRef of this actor. */ private static void sanityCheck(final ActorRef self) { final String selfPath = self.path().toStringWithoutAddress(); if (!Objects.equals(DISPATCHER_ACTOR_PATH, selfPath)) { final String message = String.format("Path of <%s> is <%s>, which does not agree with the advertised path <%s>", ACTOR_NAME, selfPath, DISPATCHER_ACTOR_PATH); throw new IllegalStateException(message); } }
private void init(String actorName){ actorQualifiedName = new StringBuilder(meteredActor.getSelf().path().parent().toStringWithoutAddress()). append("/").append(actorName).toString(); final String msgProcessingTime = MetricRegistry.name(actorQualifiedName, MSG_PROCESSING_RATE); msgProcessingTimer = METRICREGISTRY.timer(msgProcessingTime); }
public TriggerRegistrationAtJobManager(ActorRef jobManager) { this(jobManager.path().toSerializationFormat()); }
@Override protected void triggerConnectingToJobManager(String leaderAddress) { ActorSelection jobManagerSel = context().actorSelection(leaderAddress); // check if we are at the leading JobManager. if (jobManagerSel.anchorPath().root().equals(self().path().root())) { super.triggerConnectingToJobManager(leaderAddress); } else { LOG.info("Received leader address but not running in leader ActorSystem. Cancelling registration."); } }
@Override public Void apply(Object msg) { if (msg instanceof GetBucketsByMembersReply) { Map<Address, Bucket> buckets = ((GetBucketsByMembersReply) msg).getBuckets(); if(log.isTraceEnabled()) { log.trace("Buckets to send from {}: {}", selfAddress, buckets); } GossipEnvelope envelope = new GossipEnvelope(selfAddress, sender.path().address(), buckets); sender.tell(envelope, getSelf()); } return null; } };
private boolean isExecutePiggybackCommandToPubSubMediator(final DevOpsCommand<?> command) { if (command instanceof ExecutePiggybackCommand) { final ExecutePiggybackCommand executePiggyback = (ExecutePiggybackCommand) command; return Objects.equals(executePiggyback.getTargetActorSelection(), pubSubMediator.path().toStringWithoutAddress()); } else { return false; } }
private void init(final String actorName) { actorQualifiedName = meteredActor.getSelf().path().parent().toStringWithoutAddress() + "/" + actorName; final String msgProcessingTime = MetricRegistry.name(actorQualifiedName, MSG_PROCESSING_RATE); msgProcessingTimer = metricRegistry.timer(msgProcessingTime); }
public TriggerRegistrationAtJobManager(ActorRef jobManager) { this(jobManager.path().toSerializationFormat()); }
@Override protected void triggerConnectingToJobManager(String leaderAddress) { ActorSelection jobManagerSel = context().actorSelection(leaderAddress); // check if we are at the leading JobManager. if (jobManagerSel.anchorPath().root().equals(self().path().root())) { super.triggerConnectingToJobManager(leaderAddress); } else { LOG.info("Received leader address but not running in leader ActorSystem. Cancelling registration."); } }
private void processEndpointDeregistration(TopicUnsubscriptionMessage message) { String endpointKey = message.getOriginator().path().name(); if (endpointSessions.remove(endpointKey) != null) { LOG.debug("Removed subsctioption for endpoint {}", endpointKey); } else { LOG.warn("Failed to remove subscription for endpoint {} from topic", endpointKey); } }
remote.tell(new GossipEnvelope(selfAddress, remote.path().address(), buckets), getSelf()); });
private ShardStatisticsWrapper getShardStatistics(final Map<String, ShardStatisticsWrapper> shardStatisticsMap, final String shardRegion) { ShardStatisticsWrapper shardStatistics = shardStatisticsMap.get(shardRegion); if (shardStatistics == null) { if (getSender().path().toStringWithoutAddress().contains(SR_SEARCH_UPDATER)) { shardStatistics = shardStatisticsMap.get(SR_SEARCH_UPDATER); } else if (getSender().path().toStringWithoutAddress().contains(SR_CONCIERGE)) { shardStatistics = shardStatisticsMap.get(SR_CONCIERGE); } else if (getSender().path().toStringWithoutAddress().contains(SR_POLICY)) { shardStatistics = shardStatisticsMap.get(SR_POLICY); } else if (getSender().path().toStringWithoutAddress().contains(SR_THING)) { shardStatistics = shardStatisticsMap.get(SR_THING); } } return shardStatistics; }
public TriggerRegistrationAtJobManager(ActorRef jobManager) { this(jobManager.path().toSerializationFormat()); }
@Override protected void triggerConnectingToJobManager(String leaderAddress) { ActorSelection jobManagerSel = context().actorSelection(leaderAddress); // check if we are at the leading JobManager. if (jobManagerSel.anchorPath().root().equals(self().path().root())) { super.triggerConnectingToJobManager(leaderAddress); } else { LOG.info("Received leader address but not running in leader ActorSystem. Cancelling registration."); } }
/** * Process termination. * * @param message the message */ private void processTermination(Terminated message) { ActorRef terminated = message.actor(); if (terminated instanceof LocalActorRef) { LocalActorRef localActor = (LocalActorRef) terminated; String name = localActor.path().name(); if (endpointSessions.remove(name) != null) { LOG.debug("removed: {}", localActor); } } else { LOG.warn("remove commands for remote actors are not supported yet!"); } }
public AkkaJobManagerGateway(ActorGateway jobManagerGateway) { this.jobManagerGateway = Preconditions.checkNotNull(jobManagerGateway); final Option<String> optHostname = jobManagerGateway.actor().path().address().host(); hostname = optHostname.isDefined() ? optHostname.get() : "localhost"; }