public CustomExecutionContext(ActorSystem actorSystem, String name) { this.executionContext = actorSystem.dispatchers().lookup(name); }
public CustomExecutionContext(ActorSystem actorSystem, String name) { this.executionContext = actorSystem.dispatchers().lookup(name); }
public CustomExecutionContext(ActorSystem actorSystem, String name) { this.executionContext = actorSystem.dispatchers().lookup(name); }
/** * Get dispatcher of this actor, which should be good for blocking operations. * * @param actorSystem actor system where this actor is configured. * @return the dispatcher. */ static MessageDispatcher getOwnDispatcher(final ActorSystem actorSystem) { return actorSystem.dispatchers().lookup(DISPATCHER_NAME); }
/** * Get dispatcher of this actor, which should be good for blocking operations. * * @param actorSystem actor system where this actor is configured. * @return the dispatcher. */ static MessageDispatcher getOwnDispatcher(final ActorSystem actorSystem) { return actorSystem.dispatchers().lookup(DISPATCHER_NAME); }
public LocalSnapshotStore(final Config config) { this.executionContext = context().system().dispatchers().lookup(config.getString("stream-dispatcher")); snapshotDir = new File(config.getString("dir")); int localMaxLoadAttempts = config.getInt("max-load-attempts"); maxLoadAttempts = localMaxLoadAttempts > 0 ? localMaxLoadAttempts : 1; LOG.debug("LocalSnapshotStore ctor: snapshotDir: {}, maxLoadAttempts: {}", snapshotDir, maxLoadAttempts); }
public PushNotificationServerHelper(final ActorSystem actorSystem, final Configuration configuration) { this.dispatcher = actorSystem.dispatchers().lookup("restcomm-blocking-dispatcher"); final Configuration runtime = configuration.subset("runtime-settings"); this.pushNotificationServerEnabled = runtime.getBoolean("push-notification-server-enabled", false); if (this.pushNotificationServerEnabled) { this.pushNotificationServerUrl = runtime.getString("push-notification-server-url"); this.pushNotificationServerDelay = runtime.getLong("push-notification-server-delay"); } }
private BlockedNamespaces(final DistributedDataConfigReader configReader, final ActorSystem system) { super(configReader, system, system.dispatchers().lookup(BLOCKED_NAMESPACES_DISPATCHER)); node = Cluster.get(system); }
private ActorRef getNotifierActor() { if(notifierActor == null) { LOG.debug("Creating actor {}", actorName); String dispatcher = new Dispatchers(actorContext.system().dispatchers()).getDispatcherPath( Dispatchers.DispatcherType.Notification); notifierActor = actorContext.actorOf(ShardDataTreeNotificationPublisherActor.props(actorName) .withDispatcher(dispatcher).withMailbox( org.opendaylight.controller.cluster.datastore.utils.ActorContext.BOUNDED_MAILBOX), actorName); } return notifierActor; } }
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; } }
ClientActorContext(final ActorRef self, final String persistenceId, final ActorSystem system, final ClientIdentifier identifier, final ClientActorConfig config) { super(self, persistenceId); this.identifier = Preconditions.checkNotNull(identifier); this.scheduler = Preconditions.checkNotNull(system).scheduler(); this.executionContext = system.dispatcher(); this.dispatchers = new Dispatchers(system.dispatchers()); this.config = Preconditions.checkNotNull(config); messageSlicer = MessageSlicer.builder().messageSliceSize(config.getMaximumMessageSliceSize()) .logContext(persistenceId).expireStateAfterInactivity(config.getRequestTimeout(), TimeUnit.NANOSECONDS) .fileBackedStreamFactory(new FileBackedOutputStreamFactory(config.getFileBackedStreamingThreshold(), config.getTempFileDirectory())).build(); }
private SearchActor(final ActorRef aggregationQueryActor, final ActorRef findQueryActor, final ThingsSearchPersistence searchPersistence) { this.aggregationQueryActor = aggregationQueryActor; this.findQueryActor = findQueryActor; this.searchPersistence = searchPersistence; materializer = ActorMaterializer.create(getContext().system()); dispatcher = getContext().system().dispatchers().lookup(SEARCH_DISPATCHER_ID); }
ExecutionContext dispatcher = new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client); Future<Iterable<Boolean>> combinedFutures = Futures.sequence(stopFutures, dispatcher);
private ThingsAggregatorActor(final AbstractConciergeConfigReader configReader, final ActorRef targetActor) { this.targetActor = targetActor; aggregatorDispatcher = getContext().system().dispatchers().lookup(AGGREGATOR_INTERNAL_DISPATCHER); retrieveSingleThingTimeout = configReader.thingsAggregatorSingleRetrieveThingTimeout(); maxParallelism = configReader.thingsAggregatorMaxParallelism(); actorMaterializer = ActorMaterializer.create(getContext()); }
private void onFlipShardMembersVotingStatus(FlipShardMembersVotingStatus flipMembersVotingStatus) { LOG.debug("{}: onFlipShardMembersVotingStatus: {}", persistenceId(), flipMembersVotingStatus); ActorRef sender = getSender(); final String shardName = flipMembersVotingStatus.getShardName(); findLocalShard(shardName, sender, localShardFound -> { Future<Object> future = ask(localShardFound.getPath(), GetOnDemandRaftState.INSTANCE, Timeout.apply(30, TimeUnit.SECONDS)); future.onComplete(new OnComplete<Object>() { @Override public void onComplete(Throwable failure, Object response) { if (failure != null) { sender.tell(new Status.Failure(new RuntimeException( String.format("Failed to access local shard %s", shardName), failure)), self()); return; } OnDemandRaftState raftState = (OnDemandRaftState) response; Map<String, Boolean> serverVotingStatusMap = new HashMap<>(); for(Entry<String, Boolean> e: raftState.getPeerVotingStates().entrySet()) { serverVotingStatusMap.put(e.getKey(), !e.getValue()); } serverVotingStatusMap.put(getShardIdentifier(cluster.getCurrentMemberName(), shardName). toString(), !raftState.isVoting()); changeShardMembersVotingStatus(new ChangeServersVotingStatus(serverVotingStatusMap), shardName, localShardFound.getPath(), sender); } }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client)); }); }
}, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client));
private void findPrimary(final String shardName, final FindPrimaryResponseHandler handler) { Timeout findPrimaryTimeout = new Timeout(datastoreContextFactory.getBaseDatastoreContext(). getShardInitializationTimeout().duration().$times(2)); Future<Object> futureObj = ask(getSelf(), new FindPrimary(shardName, true), findPrimaryTimeout); futureObj.onComplete(new OnComplete<Object>() { @Override public void onComplete(Throwable failure, Object response) { if (failure != null) { handler.onFailure(failure); } else { if(response instanceof RemotePrimaryShardFound) { handler.onRemotePrimaryShardFound((RemotePrimaryShardFound) response); } else if(response instanceof LocalPrimaryShardFound) { handler.onLocalPrimaryFound((LocalPrimaryShardFound) response); } else { handler.onUnknownResponse(response); } } } }, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client)); }
}, new Dispatchers(context().system().dispatchers()).getDispatcher(Dispatchers.DispatcherType.Client));
new Dispatchers(context().system().dispatchers()).getDispatcherPath( Dispatchers.DispatcherType.Transaction), self(), getContext(), shardMBean);
ShardManager(AbstractShardManagerCreator<?> builder) { this.cluster = builder.getCluster(); this.configuration = builder.getConfiguration(); this.datastoreContextFactory = builder.getDatastoreContextFactory(); this.type = datastoreContextFactory.getBaseDatastoreContext().getDataStoreName(); this.shardDispatcherPath = new Dispatchers(context().system().dispatchers()).getDispatcherPath(Dispatchers.DispatcherType.Shard); this.waitTillReadyCountdownLatch = builder.getWaitTillReadyCountdownLatch(); this.primaryShardInfoCache = builder.getPrimaryShardInfoCache(); this.restoreFromSnapshot = builder.getRestoreFromSnapshot(); String possiblePersistenceId = datastoreContextFactory.getBaseDatastoreContext().getShardManagerPersistenceId(); persistenceId = possiblePersistenceId != null ? possiblePersistenceId : "shard-manager-" + type; peerAddressResolver = new ShardPeerAddressResolver(type, cluster.getCurrentMemberName()); // Subscribe this actor to cluster member events cluster.subscribeToMemberEvents(getSelf()); mBean = new ShardManagerInfo(getSelf(), cluster.getCurrentMemberName(), "shard-manager-" + this.type, datastoreContextFactory.getBaseDatastoreContext().getDataStoreMXBeanType()); mBean.registerMBean(); }