• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ActorPath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中akka.actor.ActorPath的典型用法代码示例。如果您正苦于以下问题:Java ActorPath类的具体用法?Java ActorPath怎么用?Java ActorPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActorPath类属于akka.actor包,在下文中一共展示了ActorPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testMajorityPropose

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void testMajorityPropose() throws Exception {
  final List<TestPriest> majorityTestPriests = Stream.generate(this::testPriest)
          .limit(PRIESTS_COUNT - MINORITY)
          .collect(toList());

  final List<TestPriest> minorityTestPriests = Stream.generate(this::testPriest)
          .limit(MINORITY)
          .collect(toList());

  final Set<ActorPath> priestsPaths = Stream
          .concat(majorityTestPriests.stream(), minorityTestPriests.stream())
          .map(p -> p.path)
          .collect(toSet());

  final List<TestKit> majorityKits = majorityTestPriests.stream().map(p -> p.kit).collect(toList());

  minorityTestPriests.forEach(p -> p.priest.tell(PoisonPill.getInstance(), ActorRef.noSender()));

  final ActorRef leader = system.actorOf(DecreePresident.props(new Cluster(priestsPaths), 1));
  leader.tell(new PaxosAPI.Propose("VALUE", 1), ActorRef.noSender());
  majorityKits.forEach(kit -> kit.expectMsg(new PaxosAPI.Decide("VALUE", 1)));
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:24,代码来源:PaxosTest.java


示例2: testMinorityPropose

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void testMinorityPropose() throws Exception {
  final List<TestPriest> majorityTestPriests = Stream.generate(this::testPriest)
          .limit(PRIESTS_COUNT - MINORITY)
          .collect(toList());

  final List<TestPriest> minorityTestPriests = Stream.generate(this::testPriest)
          .limit(MINORITY)
          .collect(toList());

  final Set<ActorPath> priestsPaths = Stream
          .concat(majorityTestPriests.stream(), minorityTestPriests.stream())
          .map(p -> p.path)
          .collect(toSet());

  final List<TestKit> majorityKits = majorityTestPriests.stream().map(p -> p.kit).collect(toList());

  majorityTestPriests.forEach(p -> p.priest.tell(PoisonPill.getInstance(), ActorRef.noSender()));

  final ActorRef leader = system.actorOf(DecreePresident.props(new Cluster(priestsPaths), 1));
  leader.tell(new PaxosAPI.Propose("VALUE", 1), ActorRef.noSender());
  majorityKits.forEach(kit -> kit.expectNoMsg(Duration.create(1, SECONDS)));
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:24,代码来源:PaxosTest.java


示例3: singleLeaderBroadcastTest

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void singleLeaderBroadcastTest() {
  final String prefix = "simpleLeader";
  final Set<ActorPath> broadcastPaths = LongStream.range(0, PRIESTS_COUNT)
          .boxed().map(l -> system.child(prefix + l))
          .collect(Collectors.toSet());

  final List<TestBroadcast> testPriests = LongStream.range(0, PRIESTS_COUNT)
          .boxed()
          .map(l -> testBroadcast(prefix, l, new Cluster(broadcastPaths)))
          .collect(toList());

  final List<String> decrees = Stream
          .generate(UUID::randomUUID)
          .map(UUID::toString)
          .limit(1000)
          .collect(toList());

  for (String v : decrees) {
    testPriests.get(0).broadcast.tell(new AtomicBroadcastAPI.Broadcast(v), ActorRef.noSender());
    testPriests.forEach(p -> p.kit.expectMsg(new AtomicBroadcastAPI.Deliver(v)));
  }
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:24,代码来源:AtomicBroadcastTest.java


示例4: startCommandClient

import akka.actor.ActorPath; //导入依赖的package包/类
public static ActorSystem startCommandClient(ClientConfig clientConfig) {
    Config conf = ConfigFactory.parseString("akka.cluster.roles=[" + clientConfig.getRole() + "]")
            .withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.port=" + clientConfig.getPort()))
            .withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.hostname=" + HostUtils.lookupIp()))
            .withFallback(ConfigFactory.load("application"));

    ActorSystem system = ActorSystem.create(Constants.PerformanceSystem, conf);

    Set<ActorPath> initialContacts = new HashSet<>(clientConfig.getContactPoint()
                .map(p->ActorPaths.fromString(p))
                .collect(Collectors.toList()));

    ClusterClientSettings settings =  ClusterClientSettings.create(system).withInitialContacts(initialContacts);
    final ActorRef clusterClient = system.actorOf(ClusterClient.props(settings), "clusterClient");

    system.actorOf(CommandClientActor.props(clusterClient, clientConfig), clientConfig.getRole() );

    return system;

}
 
开发者ID:Abiy,项目名称:distGatling,代码行数:21,代码来源:ClientFactory.java


示例5: testSimplePropose

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void testSimplePropose() throws Exception {
  final List<TestPriest> testPriests = Stream.generate(this::testPriest)
          .limit(PRIESTS_COUNT)
          .collect(toList());

  final Set<ActorPath> priestsPaths = testPriests.stream().map(p -> p.path).collect(toSet());

  final ActorRef leader = system.actorOf(DecreePresident.props(new Cluster(priestsPaths), 1));
  leader.tell(new PaxosAPI.Propose("VALUE", 1), ActorRef.noSender());

  final List<TestKit> kits = testPriests.stream().map(p -> p.kit).collect(toList());

  kits.forEach(kit -> kit.expectMsg(new PaxosAPI.Decide("VALUE", 1)));
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:16,代码来源:PaxosTest.java


示例6: path

import akka.actor.ActorPath; //导入依赖的package包/类
private ActorPath path(String host) {
  final String[] split = host.split(":");
  final String hostname = split[0];
  final int port = Integer.parseInt(split[1]);

  final Address actorSystemAddress = new Address("akka.tcp", "concierge", hostname, port);
  return RootActorPath.apply(actorSystemAddress, "/").child("user");
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:9,代码来源:ConciergeConfig.java


示例7: killOneByOneTest

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void killOneByOneTest() {
  final String prefix = "killOneByOneTest";
  final Set<ActorPath> broadcastPaths = LongStream.range(0, PRIESTS_COUNT)
          .boxed()
          .map(l -> system.child(prefix + l))
          .collect(Collectors.toSet());

  final List<TestBroadcast> testPriests = LongStream.range(0, PRIESTS_COUNT)
          .boxed()
          .map(l -> testBroadcast(prefix, l, new Cluster(broadcastPaths)))
          .collect(toList());

  while (testPriests.size() > PRIESTS_COUNT / 2) {
    final TestBroadcast currentLeader = testPriests.get(0);

    final List<String> decrees = Stream
            .generate(UUID::randomUUID)
            .map(UUID::toString)
            .limit(1000)
            .collect(toList());

    for (String v : decrees) {
      currentLeader.broadcast.tell(new AtomicBroadcastAPI.Broadcast(v), ActorRef.noSender());
      testPriests.forEach(p -> p.kit.expectMsg(new AtomicBroadcastAPI.Deliver(v)));
    }

    currentLeader.broadcast.tell(PoisonPill.getInstance(), ActorRef.noSender());
    testPriests.remove(currentLeader);
  }
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:32,代码来源:AtomicBroadcastTest.java


示例8: storage

import akka.actor.ActorPath; //导入依赖的package包/类
private ActorRef storage(String prefix) {
  final Set<ActorPath> storagePaths = LongStream.range(0, PRIEST_COUNT)
          .boxed()
          .map(l -> system.child(prefix + l))
          .collect(toSet());

  final List<ActorRef> testPriests = LongStream.range(0, PRIEST_COUNT)
          .boxed()
          .map(l -> system.actorOf(LinearizableStorage.props(new Cluster(storagePaths)), prefix + l))
          .collect(toList());

  return testPriests.get(0);
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:14,代码来源:LinearizableStorageTest.java


示例9: findLogger

import akka.actor.ActorPath; //导入依赖的package包/类
protected Logger findLogger(Optional<ActorPath> origin) {
    
    ActorPath path = origin.orElse(getContext().parent().path());
    
    return loggers.computeIfAbsent(
                            path, 
                            key -> {
                                return LoggerFactory.getLogger(key.toString());
                            }
    );
}
 
开发者ID:gibffe,项目名称:fuse,代码行数:12,代码来源:SystemLogActor.java


示例10: TestPriest

import akka.actor.ActorPath; //导入依赖的package包/类
public TestPriest(ActorRef priest, ActorPath path, TestKit kit) {
  this.priest = priest;
  this.path = path;
  this.kit = kit;
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:6,代码来源:PaxosTest.java


示例11: integrityAndTotalOrderTest

import akka.actor.ActorPath; //导入依赖的package包/类
@Test
public void integrityAndTotalOrderTest() {
  final String prefix = "integrityAndTotalOrderTest";
  final Set<ActorPath> broadcastPaths = LongStream.range(0, PRIESTS_COUNT)
          .boxed()
          .map(l -> system.child(prefix + l))
          .collect(Collectors.toSet());

  final List<TestBroadcast> testPriests = LongStream.range(0, PRIESTS_COUNT)
          .boxed()
          .map(l -> testBroadcast(prefix, l, new Cluster(broadcastPaths)))
          .collect(toList());

  final List<String> decrees = Stream
          .generate(UUID::randomUUID)
          .map(UUID::toString)
          .limit(1000)
          .collect(toList());

  final Random rd = new Random();
  for (String v : decrees) {
    testPriests.get(rd.nextInt(testPriests.size())).broadcast
            .tell(new AtomicBroadcastAPI.Broadcast(v), ActorRef.noSender());
  }

  final Set<List<String>> resultSet = new HashSet<>();

  testPriests.stream().map(t -> t.kit).forEach(k -> {
    final List<String> received = new ArrayList<>();
    k.receiveWhile(
            Duration.create(1, MINUTES),
            Duration.create(10, SECONDS),
            1000,
            o -> received.add((String) ((AtomicBroadcastAPI.Deliver) o).value())
    );

    resultSet.add(received);
  });

  Assert.assertEquals(resultSet.size(), 1);

  final List<String> representative = resultSet.stream().findAny().orElseThrow(IllegalStateException::new);
  Assert.assertTrue(decrees.containsAll(representative));
  Assert.assertTrue(representative.containsAll(decrees));
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:46,代码来源:AtomicBroadcastTest.java


示例12: Cluster

import akka.actor.ActorPath; //导入依赖的package包/类
public Cluster(Set<ActorPath> paths, String suffix) {
  this.paths = paths.stream()
          .map(p -> p.child(suffix))
          .collect(toSet());
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:6,代码来源:Cluster.java


示例13: paths

import akka.actor.ActorPath; //导入依赖的package包/类
public Set<ActorPath> paths() {
  return unmodifiableSet(paths);
}
 
开发者ID:marnikitta,项目名称:Concierge,代码行数:4,代码来源:Cluster.java


示例14: selectActor

import akka.actor.ActorPath; //导入依赖的package包/类
protected final ActorSelection selectActor(ActorPath path) {
    return shard.getContext().system().actorSelection(path);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:4,代码来源:LeaderLocalDelegateFactory.java


示例15: actorSelection

import akka.actor.ActorPath; //导入依赖的package包/类
public ActorSelection actorSelection(ActorPath actorPath) {
    return actorSystem.actorSelection(actorPath);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:4,代码来源:ActorContext.java


示例16: getListenerActorPath

import akka.actor.ActorPath; //导入依赖的package包/类
@Override
public ActorPath getListenerActorPath() {
    return dataChangeListenerActor.path();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:RegisterChangeListener.java


示例17: getListenerActorPath

import akka.actor.ActorPath; //导入依赖的package包/类
@Override
public ActorPath getListenerActorPath() {
    return dataTreeChangeListenerPath.path();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:5,代码来源:RegisterDataTreeChangeListener.java


示例18: getListenerRegistrationPath

import akka.actor.ActorPath; //导入依赖的package包/类
public ActorPath getListenerRegistrationPath() {
    return listenerRegistrationPath.path();
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:4,代码来源:RegisterDataTreeNotificationListenerReply.java


示例19: actor

import akka.actor.ActorPath; //导入依赖的package包/类
private static ActorRef actor(ActorSystem actorSystem, ActorPath path) {
    return await(actorSystem.actorSelection(path).resolveOne(ModuleInterpretation.DEFAULT_DURATION));
}
 
开发者ID:cloudkeeper-project,项目名称:cloudkeeper,代码行数:4,代码来源:CompositeModuleInterpreterActorTest.java


示例20: parent

import akka.actor.ActorPath; //导入依赖的package包/类
@Override
@Nullable
public ActorPath parent() {
    return null;
}
 
开发者ID:tomtom-international,项目名称:speedtools,代码行数:6,代码来源:MockActorPath.java



注:本文中的akka.actor.ActorPath类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AutoScrollHelper类代码示例发布时间:2022-05-22
下一篇:
Java GatewayDiscover类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap